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

Purging old files from a directory

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want a script which will delete files which are older than 10 days from a directory. Any help is appreciated.

Newbie.
 
Try

find /usr/dir -type f -ctime +10 -exec rm -f {} \;

Also do man on find and look at the -atime expression.

Hope this helps.

CaKiwi

After all is said and done, a lot more will have been said than done.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top