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:) Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.