Operating System - HP-UX
1833291 Members
2766 Online
110051 Solutions
New Discussion

Re: Open or Remove the file with bad name

 
SOLVED
Go to solution
Leah Chow
Frequent Advisor

Open or Remove the file with bad name

Hello,

I have a bunch of files created by users with 3rd party software, the file names are all look like c:\01042006155142bs. Could someone tell me how to open these files, or how to delete these files?

My server is HPUX 11i, thanks a lot for your help.

Leah
12 REPLIES 12
DCE
Honored Contributor
Solution

Re: Open or Remove the file with bad name


Leah,

Try using quotes around the name

cat "c:\01042006155142bs"

rm "c:\01042006155142bs"

Dave
Leah Chow
Frequent Advisor

Re: Open or Remove the file with bad name

thanks a lot, you solved my problem less than 1 minute.

Leah
James R. Ferguson
Acclaimed Contributor

Re: Open or Remove the file with bad name

Hi Leah:

A general variation of this problem is to handle a file with special, non-printing characters as well as embedded spaces or special characters. Here's one way to search-and-destroy those:

# cd filesystem
# find . -xdev name "*bad*" -exec ls -li {} \;

(or):

# ls -ilb . #...in place of the above 'find'

Either the 'find' or the 'ls' alone will expose the inode number of the file in question. Now use it to delete the file, like this:

# find . -inum 152 -xdev -exec rm -i {} \;

REMEMBER that an inode number is only unique WITHIN a filesystem! Using an interactive 'rm' is always a safety net. The '-xdev' option of 'find' also insures that you do NOT cross mountpoints (filesystems).

Regards!

...JRF...
Leah Chow
Frequent Advisor

Re: Open or Remove the file with bad name

i tried this:
find . -xdev name "*gltest*" -exec ls -li {} \

and i got this error:

find: missing conjunction


could you help me

Thanks again
Leah
Leah Chow
Frequent Advisor

Re: Open or Remove the file with bad name

Hello JRF,

i tried this:
find . -xdev name "*gltest*" -exec ls -li {} \

and i got this error:

find: missing conjunction


could you tell me what's wrong?

Thanks again
Leah
Pete Randall
Outstanding Contributor

Re: Open or Remove the file with bad name

Leah,

I think that is because you need a minus sign in front of the "name"

find . -xdev -name "*gltest*" -exec ls -li {} \


Pete

Pete
Leah Chow
Frequent Advisor

Re: Open or Remove the file with bad name

Thank you very much pete, it works.

Leah
James R. Ferguson
Acclaimed Contributor

Re: Open or Remove the file with bad name

Hi Leah:

My apologies, I dropped the "-". You should use:

# find . -xdev -name "*bad*" -exec ls -li {} \;

See the manpages for 'find(1)' for more information.

Regards!

...JRF...
Cem Tugrul
Esteemed Contributor

Re: Open or Remove the file with bad name

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=50871

Good luck,
Our greatest duty in this life is to help others. And please, if you can't
Cem Tugrul
Esteemed Contributor

Re: Open or Remove the file with bad name

also would be nice to visit the link;

http://www.helpdesk.umd.edu/topics/troubleshooting/os/unix/1231/

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Leah Chow
Frequent Advisor

Re: Open or Remove the file with bad name

Thank you all for your help, the answers are really helpful, the problem has been solved.

Leah
Cem Tugrul
Esteemed Contributor

Re: Open or Remove the file with bad name

thank's for your points
:-((
Our greatest duty in this life is to help others. And please, if you can't