Operating System - HP-UX
1835243 Members
2757 Online
110078 Solutions
New Discussion

How to rm a file that starts with \\

 
SOLVED
Go to solution
Nicholas Romany_1
New Member

How to rm a file that starts with \\

I have a file that was created from SAP named \\gorfile01\user$\Mason_Geoff\My. I have tried rm -fi "\\gorfile01\user$\Mason_Geoff\My" it did not work. Any suggestions?
4 REPLIES 4
Bernhard Mueller
Honored Contributor

Re: How to rm a file that starts with \\


Hi,

List with inode #s:
ll -i |more
Substitute with the inode number the # sign in the line below - check using:
find . -xdev -inum # -exec ll {} \;
remove using:
find . -xdev -inum # -exec rm -i {} \;

Regards
Bernhard
A. Clay Stephenson
Acclaimed Contributor

Re: How to rm a file that starts with \\

Because the shell uses the "\" character as an escape. In order to get a single backslash you must always use two backslashes. For example "\r" quotes a carraige return. You need "\\" to get a backslash and thus four backslashes to get two.
If it ain't broke, I can fix that.
Jean-Louis Phelix
Honored Contributor
Solution

Re: How to rm a file that starts with \\

Hi,

a simple rm -i should work if you use wildcards :

/home/phelix> ll *gor*
-rw-r--r-- 1 phelix CST 0 Dec 1 16:52 \\gorfile01\user$\Mason_Geoff\My
/home/phelix> rm -i *gor*
\\gorfile01\user$\Mason_Geoff\My: ? (y/n) y
/home/phelix> ll *gor*
*gor* not found
/home/phelix>

Regards.
It works for me (© Bill McNAMARA ...)
Nicholas Romany_1
New Member

Re: How to rm a file that starts with \\

I tried the wildcards and it worked.
Thanks all