Nightfire
07-03-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
firepages
07-03-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.
<?
unlink('filename.file');
?>
Nightfire
07-03-2002, 01:16 AM
oops, I meant a whole directory, which has loads of other directories, not files.
Nightfire
07-03-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
Jeewhizz
07-03-2002, 08:50 AM
www.php.net/rmdir
Try that
Jee
Flamerule
07-03-2002, 08:53 AM
I guess You probably need to have all files in your directory to be correctly chmodded...
firepages
07-03-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 !! :)
Nightfire
07-03-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
Nightfire
07-03-2002, 09:18 PM
That didn't delete anything :s
Nightfire
07-03-2002, 09:50 PM
Just trie everything on this page
http://www.php.net/manual/en/function.rmdir.php
Nothing worked.
gorilla1
10-25-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?
G
gorilla1
11-24-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.
G