View Full Version : an undeleteable file
james438
08-13-2007, 03:40 AM
http://www.animeviews.com/.hcc.thumbs/.hcc.\sdcc.jpg+t
I hope i have the address right, but how would you delete a file with a name like this?
I get error messages like:
550 Prohibited file name: .hcc.\sdcc.jpg+t : /.hcc.thumbs/.hcc.\sdcc.jpg+tor
22:19:54 Delete .hcc.\sdcc.jpg+t
On folder /.hcc.thumbs
Error .hcc.\sdcc.jpg+t (No such file or directory)
I called up my web host an he referred it to his supervisor who referred it to his supervisor who apparently was able to put it into a folder and manipulate it slightly, but it is still there. No biggie. It doesn't even do anything.
That looks like FTP to me. From a shell, you can escape the filename:
rm .hcc.\\sdcc.jpg+tor use a wildcard:
rm .hcc.*It shouldn't present a problem. That is, of course, if you're running a UNIX-based host: it looks as if you are from the paths, but some Windows FTP servers imitate a UNIX filesystem. Windows filesystems have restrictions on what characters may exist in filenames; I don't believe that file can exist on a Windows system.
james438
08-13-2007, 05:34 PM
I use two different ftp programs. One is fireftp and the other is a little known program that is out there called cjgExplorerPro-3.3.
I am not sure what a shell is. I tried changing the permissions on the file, but that didn't work as the filename that is there is an unpermitted filename and should not exist in the first place :(
Because of this it can not be renamed, deleted, and the permissions can't be changed on the file either, but I don't know much about permissions anyway.
I had a similar named file that I could access on Firefox where Firefox would not change the address for it too much. It was http://www.animeviews.com/c:\data\newt.bmp
not that it matters. The 'newt' file has already been deleted, but I don't know how. I still have the sdcc file to deal with though. Interesting problem eh? I can probably duplicate the problem again real easy, but I would rather not try it. I think I used a file upload program and renamed the file to something weird like you see above. I may have added quotes as well.
james438
11-16-2007, 04:54 AM
I am using a unix based host and have recently started a little work on manipulating flat files. I can list them and edit files now, but I am still unable to delete the file. Any ideas?
I recently tried
<?php
$file = ".hcc.thumbs";
if (!rmdir($file))
{
echo ("Error deleting $file");
}
else
{
echo ("Deleted $file");
}
?>to remove the directory since the file supposedly doesn't exist. I think that what is really happening is that the browsers and programs that I know of do not recognize the \ character in a filename and so rewrite the filename that I am type into the browser's address bar. I wonder if even PHP does the same thing.
djr33
11-16-2007, 05:47 AM
Make a PHP script in that directory.
<?php unlink('filename.extension'); ?>
And it's gone!
james438
11-16-2007, 06:28 AM
lets try something simpler. I can create files into the .hcc.thumbs directory, but I am unable to access them, but I can list them for some odd reason. I tried accessing the file from another folder like so:
<?php unlink('../.hcc.thumbs/me.php'); ?>me.php being a test file that I put into the .hcc.thumbs folder. Using cjg-explorerpro-3.3 I was able to delete the me.php file, but not the .hcc.\sdcc.jpg+t file.
If you want the supposed url to the file is http://www.animeviews.com/hcc.thumbs/.hcc.\sdcc.jpg+t
The error file I get is
Warning: unlink(../.hcc.thumbs/me.php) [function.unlink]: No such file or directory in /home/content/a/n/i/animeviews/html/test.php5 on line 1 No worries. It is a complicated problem. I called my host at godaddy and he was unable to delete it so he called his supervisor who was unable to delete it so he called his supervisor who was also unable to delete it so he called technical support and apparently they moved it into its own folder instead of deleting it.
?
twey@peordh /tmp/f/.hcc.thumbs $ ls -a
. ..
twey@peordh /tmp/f/.hcc.thumbs $ touch .hcc.\\sdcc.jpg+t
twey@peordh /tmp/f/.hcc.thumbs $ ls -a
. .. .hcc.\sdcc.jpg+t
twey@peordh /tmp/f/.hcc.thumbs $ rm .hcc.\\sdcc.jpg+t
twey@peordh /tmp/f/.hcc.thumbs $ ls -a
. ..
james438
11-16-2007, 07:21 AM
I assume you are asking a question with the question mark and the following section was you demonstrating how to delete the file from another directory. I take it ls lists the files in a directory or the stats of a particular file. I have no idea what the -a is. list all of the files? dunno. twey@peorh, dunno what that is either. Nor do I know who the question is directed at if it even is a question.
near as I can tell you are referrencing http://us3.php.net/manual/en/function.shell-exec.php That area of PHP is well beyond my scope of understanding at present.
please elaborate or someone please explain what he just said. If you need more info from me let me know too and I'll see what I can do.
I was merely demonstrating how simple it is to remove such a file, at least on a *nix host. twey@peordh /tmp/f/.hcc.thumbs $ is my prompt. ls -a lists all files; touch creates a file if one doesn't already exist; rm deletes a file. I had no issues deleting that file, and your host shouldn't have either. I suggest finding another host, as your current is evidently incompetent.
james438
11-16-2007, 01:27 PM
That could be. I supposed the old adage holds true here that you get what you pay for since I pay for next to nothing for their services. PHP has many different areas like image manipulation, flat file manipulation, regular expressions and about a hundred different areas of which there are only few that I am familiar with. This is one that may be simple, but is completely foreign to me at present and is not one I plan on becoming an expert in, but I will stick with it till I can figure out how to get rid of this file.
This isn't to do with PHP. It seems your hosts don't know how to operate their own server, at a level much more basic than PHP.
BLiZZaRD
11-16-2007, 05:01 PM
I went there and says file does not exist.
I am just wondering why the weird naming (using a %5C - thats a \ in URL speak) etc.?
I went there and says file does not exist.Apparently the hosts, having failed to work out how to delete a file on a server to which they presumably have root and physical access, have decided to put it in a folder on its own under the premise that at least it's out of the way.
james438
11-16-2007, 10:29 PM
While that may be true I normally find that when I ask for something to be done a particular way that seems unorthodox like asking them to delete a file they figure that I didn't really mean that, so decided to move it instead. When I say them I mean I see this in from people in general. People seem to hate to do things that are unusual. I can call them up and ask again, but I figured I might as well figure out how to do it myself instead of calling back and forth to get this resolved. It really isn't that important.
I think that what happened was I was learneing how to use an upload program for the first time and I somehow renamed a file during the upload process. I made the mistake twice and one of the files was deleted. Hmm, I take back what I said earlier. Why would they delete the one file and not the other? The other file, which has since been deleted is www.animeviews.com/c:\data\newt.bmp No matter.
djr33
11-17-2007, 12:59 AM
Something is very wrong about your addresses.
C: and backslashes are invalid in a URL. On the server, it would be http://..../.../.../.../.../, with no further colons.
If you are using PHP to upload, use "basename", either the function or value in the uploaded file array. Using the full path ($_FILES['file']['tmp_name'] I think) will cause big problems, if you try to place the file onto the server at such a path.
james438
11-17-2007, 01:34 AM
I didn't know what I was doing and made two dumb mistakes, but I did learn a little from them, like don't do that ;) I was able to access them once upon a time using an older version of firefox and the cjgexplorer thing, but I can not do so now. Anyway the www.animeviews.com/c:\data\newt.bmp file did get deleted.
Now I have the http://www.animeviews.com/.hcc.thumbs/.hcc.\sdcc.jpg+t file which supposedly exists at that location, but was created in 1969 with no permissions. The tech support people renamed it to that name. Any idea what the +t part means? I have a screenshot of the time that I was able to access the sdcc file using Firefox.
djr33
11-17-2007, 04:06 AM
I really have no idea what you should do about that.
There's a fundamental problem.
.. means "back one directory". "../"
And every directory starts with a single dot (and the current dir is represented as "./").
So, if your directory is named ".something", that's like typing in ..something, because it implies another dot; that will do really weird stuff, I think.
james438
11-17-2007, 04:44 AM
thanks for saying so. I was able to rename the .thumbs folder to simply thumbs though. If I do figure something new out I'll try and post my findings here. Dunno when that will be though.
C: and backslashes are invalid in a URL. On the server, it would be http://..../.../.../.../.../, with no further colons.Not true. Any Unicode character can be represented in an URL, although some require escaping.
And every directory starts with a single dot (and the current dir is represented as "./").What? Not true at all... the current directory refers to itself as ., yes. But it's not special in any way. If you had a directory named "pigs" and another named "pigsfly", if you accessed example.com/pigsfly/file.html, there wouldn't be any confusion. Likewise, example.com/.thumbs/file.html cannot be confused with example.com/./thumbs/file.html, and example.com/..thumbs/file.html cannot be confused with example.com/../thumbs/file.html. This thing about all directories starting with a dot is simply not true... I don't know where you got that idea.
The tech support people renamed it to that name. Any idea what the +t part means?It doesn't mean anything. It's just part of the filename.
BLiZZaRD
11-17-2007, 05:26 PM
I would get an FTP client such as Filezilla. run it, and browse to your file, right click on it and choose delete.
If it won't delete the top window will show an error, depending on the number it will tell you what can be done about it.
(500 error means you need server Admin rights to remove, etc.) Then I would go from there.
There is something screwy though if you call your host and say remove file X, it should be done. There shouldn't be anything on their servers they can't delete. If they can't delete a file, what else can they not do?
I know they may be cheap, but there are other, better hosts out there and without security holes.
djr33
11-17-2007, 07:40 PM
Not true. Any Unicode character can be represented in an URL, although some require escaping.
True. You can escape all you want. But the colon existing as plain text won't work, nor any backslashes.
What? Not true at all...Ok. Well, figured it made some sense. I've never really played with that myself. But, then, why is it not registering on his server? If it's not flawed in some way, then why doesn't it just delete?
I have to suspect that he's done something wrong (like forgetting to escape the backslash in the unlink() call, for instance).
james438
11-18-2007, 06:18 AM
I tried Filezilla, but it would not delete the file. The permissions is 000 (according to cjgexplorerpro) and numeric value is 600 (according to filezilla). I try to delete it using filezilla, but it says that the filename is prohibited. As far as php code to delete the file I use the following code:
<?php
$file = ".hcc.\sdcc.jpg+t.txt";
if (!unlink($file))
{
echo ("Error deleting $file");
}
else
{
echo ("Deleted $file");
}
?>or
<php unlink('../.thumbs/.hcc.\sdcc.jpg+t'); ?>but without much luck.
I have found a new problem too. I can create files in the "thumbs" folder and delete them, but I am unable to access them. It says that the file does not exist when I try to type in the url to visit the page.
Edit: Don't be mad at me, but I was able to delete the file :P I don't know why it worked this time, but the first bit of code that I used listed in this post worked. I don't know why, but it did. I don't know why I was unable to accessthe file. Probably because I typed in the address wrong. All I know is that it is deleted and I then deleted the folder too. That file has been there forever! or so it felt anyway.
BLiZZaRD
11-18-2007, 03:14 PM
Glad you got it off. The 600 was the why.. 00 means no rights, basically it locked itself out. It would be interesting to see if you could have CHMOD it to something else (644) to at least get some rights on it.
I have had files that go 000 and won't change. It is very weird. The last 0 is why you couldn't access them, For more information read up on CHMOD and permissions. :D
But if you're the owner of the file you can delete it anyway.
james438
11-19-2007, 03:03 AM
I tried countless times to change the permissions, but was never able to. I don't know for sure why I was able to use hat php code posted above to delete that file and three other ftp programs were unable to remove it as well. Maybe I entered the wrong address all those other times. I kinda doubt it, but I wouldn't be at all surprised if that was the case either. Shall I upload another file with a crazy name and see what happens ;)
djr33
11-19-2007, 03:15 AM
Well, if you want to play, here's a fairly guaranteed way to delete it if other methods fail.
First, create a folder that you DO have access to, without any strange name. Don't put anything important in that either.
After that, add any number of strange folders or files, with whatever odd names you please.
Running this *should* delete all of the files in that directory then remove the directory itself.
function rmdir_full($dirname){ //directory
//rmdir but deletes all contents as well
if ($dirHandle = opendir($dirname)) { //if open the dir
$old_cwd = getcwd(); //get current working dir
chdir($dirname); //changedir to desired dir
while ($file = readdir($dirHandle)){ //while file is retrieved from dir
if ($file == '.' || $file == '..') continue; //skip if . or ..
if (is_dir($file)) { //if it's a directory, use recursively:
if (!rmdir_full($file)) return false; //if self_function doesn't work on inner dir, return failure
}
else { //if not a dir:
if (!unlink($file)) return false; //delete file
}
}
closedir($dirHandle); //close dir
chdir($old_cwd); //changedir to first dir
if (!rmdir($dirname)) return false; //remove dir main dir; if not, return failure
return true; //it worked
}
else { //if dir didn't open
return false; //if failed, return failure
}
}
Obviously use as rmdir_full($path);, where $path is relative to the running location of the script.
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.