Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete mis-nameed Files

Status
Not open for further replies.

rmmagow

Technical User
Jan 2, 2002
93
US
One of my users created a file named -filename. I can't rm or mv it since the commands bark about the bad - parameters I am passing to it. Is there another technique for trashing these kinds of misnamed files ??
 
Hi,

For this file you can use the method below.

rm ./-filename

There can be some different methods to remove these kind of files.
If you can open gui, use filemgr . It can handle all of the strange files.
 
And I always have luck with rm "-filename". You could also probably do a rm *filename* -- but do an ls first to make sure there isn't a file you want to keep that might have "filename" as part of its name.
 
You can escape it out using the / then the filename

But you can run it like this

ls -i

Get the inode number

find * -inum INODENUMBER -exec rm {} ';'


 
Hi

The top two methods(command syntax) in deleting misnamed files is:

1)find /path_to_file -inum <file_inode_num> -exec rm {} \;

u can find inode num of a particular file by usinf ls command with flag -i

Note:This method is powerful in deleting any misnamed file

2)rm -- -file
Note:This method is simple but limited.
So if you want to remove any file with any misnames...just
goahead with first method...

No other commands wil work in this way.



sushveer
IBM certified specialist-p-series AIX5L System Administration
AIX/SOLARIS/WEBSPHERE-MQ/TIVOLI Administrator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top