LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 11-24-2004, 09:35 AM   #1
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Rep: Reputation: 35
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
 
Old 11-24-2004, 09:48 AM   #2
rjlee
Senior Member
 
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,990

Rep: Reputation: 65
You may be able to zap it using a wildcard. e.g. if the file's called "?fish" then use
Code:
rm *fish
It's likely that mc is using the ? character to replace a non-printing character (maybe something like an invalid wide character), so you won't be able to do this by typing in the filename.

Another option is
Code:
rm /backup/* /backup/.*
but be aware that you may need to fsck your disk after doing this, as it could remove the . and .. directory links from /backup/
 
Old 11-24-2004, 10:00 AM   #3
andguent
Member
 
Registered: Sep 2003
Distribution: Woody, SuSE, RH, LAS
Posts: 55

Rep: Reputation: 15
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.
 
Old 11-24-2004, 10:08 AM   #4
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
Or
rm '?fish'
Or
rm \?fish
Or
rm -i *
and answer "yes" only to the one you really want to delete.

Yves.
 
Old 11-24-2004, 10:43 AM   #5
bitpicker
Member
 
Registered: Jul 2003
Location: Germany
Distribution: Xubuntu, Ubuntu
Posts: 416
Blog Entries: 14

Original Poster
Rep: Reputation: 35
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)
.  ..
So it does see the file, as it gives me its correct name, but cannot handle it, paradoxically giving me its name while stating it can't find the file.

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
 
Old 11-24-2004, 11:49 AM   #6
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,345

Rep: Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945Reputation: 1945
normally
Code:
rm -- ?stupid_filename
or
rm \?stupid_filename
would do it... but sounds like you might have slightly deeper problems there... can you stat the file correctly? always try to use tab completeion inder bash too, to ensure that it can see the file at that leve, and there's no chance of a typo.

Last edited by acid_kewpie; 11-24-2004 at 11:51 AM.
 
Old 11-24-2004, 01:20 PM   #7
LasseW
Member
 
Registered: Oct 2004
Distribution: Fedora 7, OpenSuse 10.2
Posts: 108

Rep: Reputation: 15
I think there's an inconsistency in your file system, run fsck.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
filtering a file then deleting it. road69runners Programming 6 12-02-2004 01:54 PM
deleting SMB and starting over? Doug.Gentry Linux - Networking 2 03-17-2004 02:23 PM
deleting a file intellscreen Linux - Newbie 3 11-02-2003 12:39 PM
deleting kcore file? megaspaz Linux - General 1 11-07-2002 04:33 AM
Deleting a file...... lucifer Linux - Software 0 09-03-2002 03:36 AM


All times are GMT -5. The time now is 03:10 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration