Forum Moderators: coopster

Message Too Old, No Replies

How to delete an undeletable folder!

And I created the monster.

         

henry0

10:58 am on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I run PHP5 and was testing a script to allow users sampling a demo script
But to keep security high asides the usuals I create a new folder and a new set of scripts per each required demo with a folder extension created by a rand function
So first the folder is created and a set of tpl are copied in the new folder and written on.
To make a story short:
While testing on the production server I found some bugs and fixed them but the first trial attempt created a folder with a set of files that weight exactly as the tpl copied from and do have a correct PHP extension but refuses to be deleted or renamed or schmod etc... via FTP
Now that I am bugless I can indeed do whatever with then newly created folders and files but still cannot delete my first test.
When I try to del it it goes away but if I refresh it’s back there!

What can I do?

Thank you

Henry

The Contractor

11:25 am on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have SSH/telneted into the host and used rmdir to delete folder/directories that are empty or rmdir -r for those that have files in them. Most hosting control panels have a "file manager" which allows deleting directories/folders.

henry0

11:46 am on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I never used the file mngr on that server
so I gave it a try
and tried to rem a file within the folder
well, it looks like a Gremlin job!
The file is there, its weight is as it is supposed to be.
It looks well formed
but if I try to del it I get a "file does not exit"

The Contractor

11:50 am on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



have you tried renaming the file/folder? I did run into a problem that I was denied access to even though the permissions etc. allowed me access (I could not delete it). I ended up having the server admin delete it. I never did figure out why I couldn't delete it....

edited: also if you used the rm command , did you try rm -f filename.ext

henry0

12:27 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks.
I do not understand why
FTP did not rename it
but through the file mngr it worked only by changing the ext from PHP to " .html " then del each files and del dir

Done!

regards

Henry

TravelSite

12:57 pm on May 3, 2005 (gmt 0)

10+ Year Member



I encountered a similar problem when creating a new site. I created several directories that contained special/foreign characters. I couldn't get them deleted.

I just deleted the whole account and created a new one (quickest solution for me).

If it had been a live site I would probably have tried out some of phps file manager commands to see if they would delete it - I think the delete function is called unlink($filename);

jatar_k

9:04 pm on May 3, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



it is all about permissions and ownership

if you have files/folders that were created by php then php can always delete/update etc.

just make a quick script for cleanup

unlink('mydir');

dead easy

henry0

9:24 pm on May 3, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks jatar_k easy enough!

Yes on that server I have full ownership of my structure and do generate files and dirs via PHP.

but I have to investigate why sometimes my php schmod command does not perform the expected schmod job.

Henry