Operating System - HP-UX
1830898 Members
3155 Online
110017 Solutions
New Discussion

How to remove strange "empty" files produced by mistaking?

 
SOLVED
Go to solution
leereg_2
Occasional Advisor

How to remove strange "empty" files produced by mistaking?

I produce a strange file named images, I can see it when I issued "ll", but when I try to remove it with command "rm images",It displayed the message that there is no such files.Why?
Always UNIX!
9 REPLIES 9
Satish Y
Trusted Contributor

Re: How to remove strange "empty" files produced by mistaking?

Hi Lee,

Can u send a sample list?.
U try to remove them using,

/bin/rm -- ""

Cheers...
Satish.
Difference between good and the best is only a little effort
leereg_2
Occasional Advisor

Re: How to remove strange "empty" files produced by mistaking?

It can be discribe as the attachment.

Thanks a lot for you help!


Always UNIX!
Patrick Wallek
Honored Contributor
Solution

Re: How to remove strange "empty" files produced by mistaking?

The problem you are having is that there is probably a non-printable character at either the beginning or end of the filename.

Try removing the file with:

rm images*

or

rm *images

That should do the trick for you.
leereg_2
Occasional Advisor

Re: How to remove strange "empty" files produced by mistaking?

I got it!
It was done like this:
#rm images*

Thanks a lot,Patrick!
You are really expert!

Always UNIX!
leereg_2
Occasional Advisor

Re: How to remove strange "empty" files produced by mistaking?

Another stange file which can not be deleted:
In my home dir, there is file named:ENGLISHSETUP.PDF;$sessionid$MTVR4YQAAAKVZAMTA1FU4GQ
I can not remove it.

Thanks in advance!
Always UNIX!
Wodisch
Honored Contributor

Re: How to remove strange "empty" files produced by mistaking?

Hello Leereq,

your problems seem to be just quoting!
First, use the option "-b" for your "ls" - only then you will
be shown the "invisible" characters which caused your
problem in the first case you posted. Then use single
quotes around the file names, for without them your
shell will substitute "$session" with the contents of the
variable "session"...

HTH,
Wodisch
Bart Paulusse
Respected Contributor

Re: How to remove strange "empty" files produced by mistaking?

Hi Lee,

try this:

rm -i *PDF*

with -i you are asked to confirm delete for every *PDF* file in the directory. So if there are more files in that directory that have PDF in their filename you only answer y for file: ENGLISHSETUP.PDF;$sessionid$MTVR4YQAAAKVZAMTA1FU4GQ and n (no) to keep all others.

regards,

Bart
leereg_2
Occasional Advisor

Re: How to remove strange "empty" files produced by mistaking?

It was done by:
#rm -i *.PDF.*

Thanks, expert!


Always UNIX!
Satish Y
Trusted Contributor

Re: How to remove strange "empty" files produced by mistaking?

Hi,

Try with,

rm "ENGLISHSETUP.PDF;\$sessionid\$MTVR4YQAAAKVZAMTA1FU4GQ"

I just enclosed in file name quotes and escaped '$' chars.

Cheers...
Satish.
Difference between good and the best is only a little effort