Forum Moderators: bakedjake

Message Too Old, No Replies

unix find - negative matching

excluding folders

         

jamie

11:48 am on Feb 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



hi,

i am trying to fine-tune a find command which deletes html files in some folders but not others:

find /www/sites/domain.com/htdocs/ -name '*htm*' -exec rm -f {} \;

the above command deletes all of them, but i want to exclude some folders. can anyone help?

many thanks

jamie

1:40 pm on Feb 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



it's ok, i have just found a roundabout way using xargs and grep -v

find /www/sites/domain.com/htdocs/ -name '*htm*' ¦ grep -v templates ¦ grep -v javascript ¦ grep -v php ¦ xargs rm -f

:)