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

Delete files older then.

Status
Not open for further replies.

blueeyedme

Technical User
Nov 27, 2002
39
NL
Hi,

I kind of forgot how to delete files older then for example 5days, as im trying to create a script that will delete old log files. I thought it was used with -mtime or something?

thanks.
 
Something like
Code:
find . -name "*.log" -mtime +5 -print   # to check
find . -name "*.log" -mtime +5 -exec rm {} \; # to do it
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top