fezzik Posted October 14, 2006 Share Posted October 14, 2006 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 https://forums.phpfreaks.com/topic/23956-mkdir-help/ Share on other sites More sharing options...
tomfmason Posted October 14, 2006 Share Posted October 14, 2006 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 https://forums.phpfreaks.com/topic/23956-mkdir-help/#findComment-108872 Share on other sites More sharing options...
fezzik Posted October 14, 2006 Author Share Posted October 14, 2006 Cool! Thanks Tom. I'm coding some of this now. Thanks for letting me know the names of the read, write and copy functions. Link to comment https://forums.phpfreaks.com/topic/23956-mkdir-help/#findComment-108875 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.