HPE 9000 and HPE e3000 Servers
1844843 Members
2363 Online
110233 Solutions
New Discussion

not able to delete a file

 
Dottie Hamilton
Contributor

not able to delete a file

I am trying to delete a file that is displayed when I do an ls on the directory, but when I try rm filename get response of
$ rm testsite rm: testsite non-existent

-rw-rw-r-- 1 hcioper staff 60282880 Dec 12 2000 testsite

Why?

thanks for you help

-DH
5 REPLIES 5
MANOJ SRIVASTAVA
Honored Contributor

Re: not able to delete a file

Hi

try
rm -i testsite*

this will dispaly the name of the file with any special characters like blank after the filename also and then you can delete it.

or like rm -i *testsite*

Manoj Srivastava
S.K. Chan
Honored Contributor

Re: not able to delete a file

The file might contain "unprintable" characters, which you can see from the "ls" command. Another "cool" way that you can use is list the file's inode number and use find to delete it. For example (say the file "testsite" is in /var/tmp), you would ..

# cd /var
# ls -i tmp | more
...
...
22531 testfile
....
# find tmp -inum 22531 -exec rm -f {} \;

The above remove "testfile" by its inode number (22531)
Thomas J. Harrold
Trusted Contributor

Re: not able to delete a file

Try the "ls -q" command in that directory. You might see something like:

tes???tsite

The -q option, replaces non-printable characters with the ? character. If you see this, then use one of the methods described in the responses above.

-tjh
I learn something new everyday. (usually because I break something new everyday)
Pierce Byrne_1
Frequent Advisor

Re: not able to delete a file

The most likely option is that there are control chars, it is not path related as you are not executing the file. I would strongly recommend that you use the -i option with rm if you are removing a file using a wild card so that you are prompted for confirmation.
F Verschuren
Esteemed Contributor

Re: not able to delete a file

You can alsow try :
ll > /tmp/unicname
vi unicname
if you look in the file you can see te ecaxt name.
if it looks like te^]stsite
you can remove it by using rm "te^]stsite"

hth