dir and file functions [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

dir and file functions [SOLVED]

Post by mikeeeeeeey »

Morning all,

I've been building an Asset Management system for a while now, incorporating a MySQL database aswell as using dir functions in PHP, but now I feel like I shouldn't really be using MySQL for this since it's based more around the structure of the folders and files, and if I really needed database style storage for information I could probably get away with using XML instead.

So far, I'm confident in using making, renaming and delete directories, aswell as parsing folders for contents, creating links to files and deleting files/folder contents.

I'm just wondering if there's anything else you can do with files? Extracting the filesize, and other info such as like when it was created/last modified would be good too.

I've checked the PHP.net site, and there seems to be some stuff based around filesystem, but it doesn't really make sense.

If anyone could help, much appreciated.

Thanks in advance :wink:
Last edited by mikeeeeeeey on Thu Apr 05, 2007 7:14 am, edited 1 time in total.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

The stat function is very handy for getting file information. http://us2.php.net/function.stat

Remember to call clearstatcache() first though.
bubblenut
Forum Newbie
Posts: 20
Joined: Sat Feb 03, 2007 4:16 am
Location: London

Post by bubblenut »

You may also want to check out:

filesize - Size of the file
fileatime - Last access time
filemtime - Last modified time
User avatar
mikeeeeeeey
Forum Contributor
Posts: 130
Joined: Mon Jul 03, 2006 4:17 am
Location: Huddersfield, UK

Post by mikeeeeeeey »

nice one guys, thanks a lot.
Post Reply