stormx Posted November 8, 2008 Share Posted November 8, 2008 Hello all, I am currently trying to create a script to empty/clear out a folder, so far its failed. This is my current code: <? rmdir("/home/root/public_html/images/temp/"); ?> I give it the permissions 777, it gives me a 500 error. When it's on default 644 permissions, I get the error: Warning: rmdir(/home/root/public_html/images/temp/) [function.rmdir]: No such file or directory in /home/root/public_html/images/delete_files.php on line 3 Now I believe everything is correct, I just can't figure it out, please help:) Link to comment https://forums.phpfreaks.com/topic/131916-php-clear-folder/ Share on other sites More sharing options...
stormx Posted November 8, 2008 Author Share Posted November 8, 2008 I got the script working, but its deleting the folder. Can anyone mod it to just delete whats in the folder instead? Link to comment https://forums.phpfreaks.com/topic/131916-php-clear-folder/#findComment-685312 Share on other sites More sharing options...
wildteen88 Posted November 8, 2008 Share Posted November 8, 2008 rmdir does just that removeds the directory. If you only want to remove the directory contents then there isn't a built in function for this. You'll have to piece together your own function, such as this. Alternatively just use rmdir to remove the directory completely then mkdir to recreate it. Link to comment https://forums.phpfreaks.com/topic/131916-php-clear-folder/#findComment-685327 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.