Jump to content

mkdir help


fezzik

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
Link to comment
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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.