Operating System - HP-UX
1834454 Members
2555 Online
110067 Solutions
New Discussion

Re: Remove files #filename

 
SOLVED
Go to solution
Ulf Furn
Regular Advisor

Remove files #filename

Hi i have some files that i need to remove. But the filename starts whit a #filename.
How do i remove files like this.
???
//Stefan S
15 REPLIES 15
Robert-Jan Goossens
Honored Contributor

Re: Remove files #filename

Hi,

# rm -- #filename

Robert-Jan.
Colin Topliss
Esteemed Contributor

Re: Remove files #filename

Quote the filename.

eg:

rm "#myfile"

Pete Randall
Outstanding Contributor

Re: Remove files #filename

Or the old standby:

rm -i

and answer no to all the others.



Pete

Pete
Jeff Schussele
Honored Contributor

Re: Remove files #filename

Hi Stefan,

Use the following:

rm -i /path/to/dir/*

then it will prompt Y/N for each file. Only answer Y to that file.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Darren Prior
Honored Contributor

Re: Remove files #filename

Hi Stefan,

rm -i -- #filename

-i interactive - gives you a y/n prompt
-- treat everything after this as the filename

regards,

Darren.
Calm down. It's only ones and zeros...
RAC_1
Honored Contributor

Re: Remove files #filename

or

ls -il note down inode number for file.

find . -inum inode_no -exec rm {} \;
There is no substitute to HARDWORK
Ulf Furn
Regular Advisor

Re: Remove files #filename

Non of yor tip did work.
This is the name of the file #libOvBbcThread.sl
if i do the command file *
in the directory.
#libOvBbcThread.sl
PA-RISC1.1 shared library -not stripped
And if i do rm *

raptor:/opt/OV/lib#rm -i *
#libOvBbcBase.sl: ? (y/n) y
rm: #libOvBbcBase.sl not removed. Text file busy


Ahhh Help !
Darren Prior
Honored Contributor
Solution

Re: Remove files #filename

Try fuser * in the appropriate dir, if a PID is returned then use ps -ef | grep to identify which process has the file open.

regards,

Darren.
Calm down. It's only ones and zeros...
Colin Topliss
Esteemed Contributor

Re: Remove files #filename

OK,

so the first thing to do is an fuser on the file to work out what is using it.
Secondly, you need to work out if that process is a valid one that you need to be running - if it is, you shouldn't be deleting this file!

Basically the error is telling you that that particular file (actually a shared library) is in use.

Col.
Pete Randall
Outstanding Contributor

Re: Remove files #filename

Why would you want to remove an OpenView shared library?


Pete

Pete
Colin Topliss
Esteemed Contributor

Re: Remove files #filename

FYI, the processes that have this file open will probably turn out to be opcmona and llbserver - part of OpenView (OVO).

You really don't want to be removing this file (or any others in that directory) if you want to continue using OVO.
James R. Ferguson
Acclaimed Contributor

Re: Remove files #filename

Hi Stefan:

You need to escape the comment character:

# rm \#filename

Regards!

...JRF...
Ulf Furn
Regular Advisor

Re: Remove files #filename

Hmm i have to remove manualy
becose the system is corupt.
Thanks for the help.
The trick whit the fuser
whas perfect.
//S
Bill Hassell
Honored Contributor

Re: Remove files #filename

Just a note about files with # in front. The easiest way is to remove the shell's special meaning for # with a backslash. Otherwise, the # starts a comment for the rest of the line.

These files, especially is part of an installed product, are created when the software is patched while running (a bad thing to do!) The shared library (.sl) file was busy so it was renamed to #xxxxx.sl and the new one put into place. Once the application is PROPERLY shutdown, the #xxxxxx.sl file will be closed and the new one will be used when the app starts again.

Important: if this was indeed a patch and there was something in the .sl file that needed fixing, if it is busy, your application is running UNPATCHED. Always shutdown apps before patching.


Bill Hassell, sysadmin
Michael Duthie
Trusted Contributor

Re: Remove files #filename

or use CDE File manager, click the file and drag it to the trash bin.

Bill Gates would be proud of me.