View Full Version : deleteing directories

Jul 3rd, 2002, 12:48 AM
How can I delete files that were made by the server in ftp? Everytime I try I get "Permission denied". Do I have to delete them by a script or something? I've tried everything I can think of. Changing permissions, changing chmod, etc

Jul 3rd, 2002, 01:11 AM
yes you will need to use a script to delete the files , or change the ownership of the files, & since some hosts wont let you CHOWN then deletion is probably easiest.


Jul 3rd, 2002, 01:16 AM
oops, I meant a whole directory, which has loads of other directories, not files.

Jul 3rd, 2002, 02:39 AM
I've tried renaming and unlinking, both come up with permission denied.

Warning: Rename failed (Permission denied) in /home/chatterspics/public_html/clear.php on line 3

The directories are chmoded to 777, if that helps

Jul 3rd, 2002, 08:50 AM

Try that


Jul 3rd, 2002, 08:53 AM
I guess You probably need to have all files in your directory to be correctly chmodded...

Jul 3rd, 2002, 09:42 AM
hmmm OK - you can try this BUT BE VERY CAREFUL!!!!!

exec('rm -f -R thisdirectory');

and I mean careful cos if you get this wrong you get it wrong bigtime! that should remove the directory and all its contents including subdirectories.

again BE CAREFUL !! :)

Jul 3rd, 2002, 02:08 PM
Ok, I execute that in the directory I want to delete, or name "thisdirectory" to the directory I want to delete? I don't wanna mess it up :s

Jul 3rd, 2002, 09:18 PM
That didn't delete anything :s

Jul 3rd, 2002, 09:50 PM
Just trie everything on this page


Nothing worked.

Oct 25th, 2002, 12:11 AM
My host told me that this has to do with the PHP script not "running as user". They say that you want to use a perl script to perform these kinds of operations (especially if you dont want the directory to have universal write access). Does this make sense? Is it possible to call a perl script from a php script in order to perform some of these sensitive operations, or is that a mistake?


Nov 24th, 2002, 07:59 PM
I finally got this to work. Again, on my host, php does not run with the authority needed to do deletes, renames, etc. So in my php script, I set up a call to a cgi written in perl that handles those actions. It works.