Operating System - Linux
1824166 Members
3935 Online
109668 Solutions
New Discussion юеВ

Re: problem with strange file

 
Luca Frigatti
Contributor

problem with strange file

Hi all!
On HP-UX 10.20 I have the following problem.
In one directory on my server I saw some file in the followin format :
@^DM-^V0@^DM-fM-|
Are there any way to delete them?
Thanks in advance for your help and your support.
6 REPLIES 6
Heiner E. Lennackers
Respected Contributor

Re: problem with strange file

Hi,

there is an old quote "Unter UNIX der find ist dein freund" (in UNIX the find(enemy) is your friend):
# cd
# ls -li
(grep the inode)
# find . -type f -inum -exec rm {} \;
(hope you see the bachslash before the ; )

Heiner

if this makes any sense to you, you have a BIG problem
Ron Kinner
Honored Contributor

Re: problem with strange file

If your file has a few real characters then you can usually kill it with a judicious use of the asterisk

rm *M*M*fM*

should kill your:
@^DM-^V0@^DM-fM-|
just make sure you don't kill something you need.

You can also move all of the good files out of the directory then do rm * then move the good files back.

Ron
Jeffrey S. Sims
Trusted Contributor

Re: problem with strange file

You can also escape the characters that are usually used in the command line use the \ to escape them such as:

rm \@M\-auxb

This should work for you.
Bill Thorsteinson
Honored Contributor

Re: problem with strange file

Before removing files using wildcards you may want to do a 'ls' first. Alternatively use 'rm -i' to prompt you for deletion.

You can use the file completion of bash to fill in the name for you, and it will properly escape the characters. For example enter
'rm @' then hit the escape key a couple of times.
Magdi KAMAL
Respected Contributor

Re: problem with strange file

Hi Luca,

Easy way to do it :

1.
# ls /directoryWhereTheFileIs > /tmp/bizare.sh

2.
# vi /tmp/bizare.sh
and remove all other files but not the bizare one. Then add the "rm" command in the begining, and the content of your /tmp/bizare.sh will be like :

rm *^F.^M...

3.
# sh /tmp/bizare.sh

And the bizare file will be away .


HTH
Magdi

Kelli Ward
Trusted Contributor

Re: problem with strange file

Also,
Rather than trying yo delete using the command line. Use your file manager in your desktop environment.
Open to the file folder find the file, right click and delete it or drag and drop in to your trash can. (This will only work if the file has write permissions, but those can be added by right click/properties)
I've found it to be the quickest, easiest way to delete a file with a strange name. Using the command line can be dangerous if you are not careful.
Good luck,
Kel
The more I learn, the more I realize how much more I have to learn. Isn't it GREAT!