Forum Moderators: bakedjake

Message Too Old, No Replies

How to delete files ending with "_#*$!.htm"

         

irock

4:30 am on Feb 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, I would like to do some house cleaning for my Linux box. Could anyone tell me how to delete files ending with "_#*$!.htm" , "_yyy.htm" , "_zzz.htm"?

marcs

4:42 am on Feb 6, 2006 (gmt 0)

10+ Year Member



I'm probably missing something here, but this should work :

rm *_yyy.htm

Obviously this only works if the files are all in the local directory.

To do this machine-wide (as root) :

rm `locate _yyy.htm`

Or use find instead of locate.

There's better (regex based) ways to handle the _yy.htm but odds are that string would only be found at the end of a filename.

zCat

6:59 am on Feb 6, 2006 (gmt 0)

10+ Year Member



Starting in the topmost directory you want to clean:

find . -name "*_*.htm" -exec rm -f {} \;

You might want to check that first though with

find . -name "*_*.htm" -exec ls {} \;

to check which files will be deleted.

irock

12:25 pm on Feb 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



find . -name "*_*.htm" -exec rm -f {} \;

Thanks. THis line works perfectly.