Deleting files from server

Soldato
Joined
30 Sep 2003
Posts
10,916
Location
London
I have a directory on my Apache-hosted webspace which I want to delete.

I can't erase it via FTP because it was created by the server and not directly by me (images uploaded as an archive and decompressed on the server), and thus I don't have permission to delete it because I don't own it.

I can't change the permissions for the above reason.

I don't have shell access.

What do I do?
 
If you can access Cpanel try deleting it from the File Manager.

If it's owned by the server, then the only thing you can do is ask your hosting to relinquish ownership back to yourself.

This has happened to me sometimes when unpacking stuff on the server.
 
Or you can use a quick PHP script to removed the directory/files as Apache will run the PHP script, and thus have permission to remove the directory it created originally.

Though it can be potentially dangerous if you're unsure what you're doing.

http://uk.php.net/manual/en/function.rmdir.php (need to delete the files first - see comments on the page)
http://uk.php.net/manual/en/function.exec.php (run a shell command exec('rm -rf /path/to/directory')

I've used the latter in the past to clean up directories of several thousand files where FTP/cPanel access isn't efficient.
 
Thanks, guys. Managed to persuade the gallery software to delete the folder itself, but useful to know what to do in the future!
 
Back
Top Bottom