Jump to content

Archived

This topic is now archived and is closed to further replies.

fezzik

mkdir help

Recommended Posts

Can anyone give me some advice on the best method to use to create new directories via mkdir. If other functions are more appropriate to use please let me know.

Background on what I wish to accomplish...
I would like to organize files upon upload based on which group/category they belong to.

I have one page that manages groups/categories called category.php. I would assume this would be the best page to manage directories since they are associated with the category. When I create a new category the script would validate by checking if the directory already exists and if it does not would create the new directory. Then if I decide to delete a category I would like to create a method that would move existing files within the directory to a temp directory and then delete the requested directory. Renaming directories would also be a nice feature if I needed to modify a category name.

I'm currently reading the php manual for the best smethod to accomplish this. If anyone has any experience or can direct me to some good tutorials I would appreciate it.

Best,

Fezzik

Share this post


Link to post
Share on other sites
Well I am about 99% sure that mkdir is the only function that php has for creating directories. Now as far as the renaming of the directory. I think that you will have to first create a new directory with the new name and then use a recursive function with readdir, fread and fwrite to copy the files to the new directory.

Good Luck,
Tom

Share this post


Link to post
Share on other sites
Cool! Thanks Tom. I'm coding some of this now. Thanks for letting me know the names of the read, write and copy functions.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.