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!

delete oldest files from a large directory

Status
Not open for further replies.

denalibird

IS-IT--Management
Apr 20, 2001
11
US
We are trying to delete files 14 days and older from a directory that contains a lot of files. We have been using the following:



find /logs -mtime +14 -type f -exec rm {} \;

This returns an error that the "list is too long."

Does anyone know of another way to do this?

Thanks!
 
find /logs -mtime +14 -type f | xargs rm

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top