Deleting a file starting with a ?
I have a strange phenomenon on my harddisk: I copied a lot of files in various subdirectories into a directory /backup before updating the system, and after that went well the files were no longer needed and I wanted to delete them. But there is one file which I cannot delete because for reasons I don't know it has turned out to have a question mark as the first symbol. The command line doesn't even show the file using ls with any parameters, but I can see it in mc. As it is in a subdirectory, I can't delete the directory and the ones above either.
Any suggestions? Robin |
You may be able to zap it using a wildcard. e.g. if the file's called "?fish" then use
Code:
rm *fish Another option is Code:
rm /backup/* /backup/.* |
Am I reading you correctly that it is a subdirectory within a parent directory that should also be deleted?
If you run "rm -rf /backups/mybackupfolder" it will delete mybackupfolder and everything it contains. If you want to delete "/backups/my" which contains: "/backups/my/backup/folder/?confusedfolder" Then just try "rm -rf /backups/my" Suggestions above also work too. |
Or
rm '?fish' Or rm \?fish Or rm -i * and answer "yes" only to the one you really want to delete. Yves. |
None of these suggestions work. Some more detail: on a command line as root, if I enter the directory the file is in, 'ls' without any parameters produces the following output:
Code:
/bin/ls: powErpmc250.h: File or directory not found (actually that is in German) In mc the filename is the same but with a ? in front, and it is red - the colour mc on my system uses to mark erroneous things such as symlinks missing their target. Mc lists the file as zero length and with a date of Jan 1st 1970. I can even touch powErpmc250.h in the same directory, after which I have two files of the same name in there, with no question mark. The question mark reappears when I delete one, I can't delete both at once, nor the directory they're in. If I copy another file into the directory and change its name to the same as the offending file, both are listed with identical properties, but only one can be deleted, one always remains and reverts to zero length etc. Robin |
normally
Code:
rm -- ?stupid_filename |
I think there's an inconsistency in your file system, run fsck.
|
All times are GMT -5. The time now is 07:04 PM. |