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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QUESTION FOR AIXSPADMIN

Status
Not open for further replies.

jalge2

Technical User
Feb 5, 2003
105
US
That worked great and I think you for the help. But my next question is, I have more than just the wavelog.*. There is also a batlog.log.*, userr.*, and hislog.*. Is there a way to put those all in the same line or do I have to write this out for each one?
 
I would use a for loop:

for Variable in wavelog.* batlog.log.* userr.* hislog.*
do
find /path -name $Variable -mtime +7 | xargs rm
done

 
You can do it in one invocation of find

find /dirname -name "wavelog.*" -o -name "batlog.log.*" -o -name "userr.*" -o -name "hislog.*" -mtime +7 -exec rm {} \;

-o adds the next element as an or

Dave
 
Ooops. I forogt to put the parentheses in


find /dirname \( -name "wavelog.*" -o -name "batlog.log.*" -o -name "userr.*" -o -name "hislog.*" \) -mtime +7 -exec rm {} \;

Dave
 
[mad] This was my question [bigsmile]

Of course that is possible, but why use the old '\;' which I hate, piping to xargs is much cleaner.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top