Operating System - HP-UX
1833862 Members
2362 Online
110063 Solutions
New Discussion

Re: One strange file can't be removed

 
j773303
Super Advisor

One strange file can't be removed

rm /dev/rmt/0mo
will fail to remove this file, due to the
message file not exist. But it is autually
existing in /dev/rmt. Anyone has the experience
about how to remove the strange file? Thanks.

Note: I have tried
rm /dev/rmt/*
rm /dev/rmt/?0?
rm /dev/rmt/?0*
all of above are failed to remove.
Hero
6 REPLIES 6
Michael Tully
Honored Contributor

Re: One strange file can't be removed

Try this:

# cd /dev/rmt
# rm -i *

and wait for the file to show up, alternatively please show us the full file listing.

# ls -lsa /dev/rmt
Anyone for a Mutiny ?
A. Clay Stephenson
Acclaimed Contributor

Re: One strange file can't be removed

Be very careful running rm /dev/rmt/* without the -i flag. You almost certainly blew away your tape device nodes.

The first thing that you should do is an ls -b /dev/rmt. The -b option will display all the non-printable characters as octal so that you know what you are dealing with. From there, you can make an intelligent choice for a regular expression to feed the rm command BUT use it in conjunction with -i so that you must answer 'y' before the file is removed.

If it ain't broke, I can fix that.
Ian Kidd_1
Trusted Contributor

Re: One strange file can't be removed

another way would be to use the find with the -exec option

find /dev/rmt -name "*0mo*" -exec rm -i {} \;

DEFINITELY use the -i option anytime a wildcard is used with rm.
If at first you don't succeed, go to the ITRC
Brian M Rawlings
Honored Contributor

Re: One strange file can't be removed

Try rmsf, see man page for specific options. Files in /dev are 'special files' (well, most of them), and rmsf is 'remove special file', which the traditional unix compress/truncate naming convention shrunk to four letters.

As others have noted, take great care using star names and wild cards in conjunction with any commands that delete, in an environment that doesn't have a "recycle bin"...

Regards, --bmr
We must indeed all hang together, or, most assuredly, we shall all hang separately. (Benjamin Franklin)
Brian M Rawlings
Honored Contributor

Re: One strange file can't be removed

One other idea, at least for troubleshooting: use mv rather than rm. If you find the right combination of letters or wildcards to grab this file, changing its name to something simple (that you can then delete at your convenience) may be preferable.

Also, I hope you will post the solution you eventually employ to get rid of this pesky thing, I'm intrigued.

--bmr
We must indeed all hang together, or, most assuredly, we shall all hang separately. (Benjamin Franklin)
Sridhar Bhaskarla
Honored Contributor

Re: One strange file can't be removed

Hi,

A work around. Create a directory and copy all the files that you dont' want to remove. Once it is done then do a 'rm -rf /dev/rmt/'.

Create a directory /dev/rmt. Run 'insf -e' command and it will create devices files for you.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try