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

Deleting files over 15 days old

Status
Not open for further replies.

Bloobird

Programmer
Oct 23, 2001
49
GB
Hi - Is there any easy way of deleting files that are over 15 days old from the system ? If necessary, I can use the day the files were created as the extension - e.g. <filename>.20020520

Thanks
 
Hi,
Try some useful options of find command:
# find /tmp -name &quot;*.ext&quot; -mtime 5 -exec ls -l {} \;

The above command will list all files in /tmp with extension .ext which were created/modified 5 days ago. You can change ls -l to rm and then you will delete the files.

mewa
 
Use -mtime +15 to delete those files more than 15 days old, ie:

find /tmp -mtime +15 -name '*.ext' -exec rm {} \;

HTH.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top