View Full Version : File management problem...

08-12-2007, 05:04 PM
A very curious thing has recently happened to me. I uploaded several files, then attempted to delete them, only to find that they coudn't be; the cause: the files you selected don't exist. This was extremely odd to me; so, I tried my hand at getting rid of them via PHP isntead of my file manager. Unlink() didn't work, nor did uploading a file with the exact same name; it simply showed up along with the buggy one, with the exact same name. So, I tried to move them into a directory and delete the directory with rmdir() to no avail.

Now I ask, is there a workaround, any way for me to rid my file manager of these buggy files?

08-12-2007, 05:24 PM
this is weird have you tryed veiwing one to see if there is any information or data in it ?

08-12-2007, 05:36 PM
Indeed. The file manager shows each as having a filesize, but upon editing, it reports that it could not retrieve the data...

08-12-2007, 05:55 PM
Okay, well, I've found the problem, but I have a bad feeling it doesn't have a solution...

I had several filenames stored in a file. Then, I ran a PHP script that saved the corresponding files with the names stored in said file. Unfortunately, I used PHP's file() function to pull the names, and forgot to use the FILE_IGNORE_NEW_LINES flag. This, I take it, is a serious problem.

It means that there are files in my manager with carriage returns at the end of their names that is causing them to be indestructible. Solutions?

08-12-2007, 05:58 PM
if your file manager is on a server can you ask the server administrator to take out the seleted files ? or if that cant be done back up the files you want to keep and have it all cleared then upload your files again

08-12-2007, 05:59 PM
Gah! No other way around, then? Okay, thanks.

Just had to call unlink() on the filename with a "\r" appended...

08-12-2007, 06:35 PM
Assuming you're on linux you could use a wildcard for the filename when deleting the files from the command line. ie.
rm file*
This is for future reference, I know you solved your problem.