Jump to content


Photo

mkdir help


  • Please log in to reply
2 replies to this topic

#1 fezzik

fezzik
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 14 October 2006 - 08:56 PM

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

#2 tomfmason

tomfmason
  • Staff Alumni
  • Advanced Member
  • 1,696 posts
  • Locationstealing your wifi

Posted 14 October 2006 - 09:01 PM

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

Traveling East in search of instruction, and West to propagate the knowledge I have had gained.

current projects: pokersource

My Blog | My Pastebin | PHP Validation class | Backtrack linux


#3 fezzik

fezzik
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 14 October 2006 - 09:16 PM

Cool! Thanks Tom. I'm coding some of this now. Thanks for letting me know the names of the read, write and copy functions.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users