deleting files created with PHP
If you ahve the problem of deleting a bunch of files that are owned by "Nobody" becasue a php script created them, here is a cheat that may work so you do not have to write a script to delete them:
Say you have a directory of 20 files owned by nobody, and you want them all deleted. In that directory, do gzip * On my server, when this is done, it zips each one of those up, and deletes the original file, but the zip file is owned by the account I am logged in as. Now I am free to jsut delete all those zip files.
Just something I came across today while playing with the gzip command, and thought I would share it. (I test zipped a file, then unzipped it, and suddenly my php script errored our wrtiting to the original file... it no longer was the owner
-Greg
PS. yes, I can just issue [B]rm *[B] and it WILL delete all the files, but it will PROMPT me on every file. If you have more than 5 or 10, this is a pain.
mairving posted this at 14:01 — 18th July 2006.
They have: 2,256 posts
Joined: Feb 2001
That depends upon the permissions of the file. If it is owned by nobody and the permissions are 744, then you won't be able to delete it unless you are su.
FYI, rm -f removes the prompt.
Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states
nielsencl posted this at 05:51 — 18th January 2007.
He has: 20 posts
Joined: Dec 2004
I ran into the same problem, but I don't have shell access, so it limits what I can do.
I contacted support because while I have a reseller account, I could not delete the files created with a script.
Support figured it out, and created a chron job that periodically calls a script and it flags all the files with my user name.
Nielsen Technical Services
http://www.DomainIncubation.com/
http://www.Best-Free-Search-Engine-List.com
andy206uk posted this at 23:34 — 18th January 2007.
He has: 1,758 posts
Joined: Jul 2002
Or you could just delete them with a php script using unlink()
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.