Delete files older than X days
Delete Log Files with -mtime PDF Print E-mail
Written by Administrator   
Saturday, 14 March 2009 17:30
  1 

  2 
  3 
  4 
  5 
  6 
  7 
  8 
  9 
 10 
 11 
 12 
 13 
Be really careful as these are powerful commands which blow away files 
  wholesale.
 
Note: 
To find files created more than 5 days use -mtime +5
To find files created less than 5 days use -mtime -5
  
For log files older than 5 days
find /opt/app/logs/ -name *.log -mtime +5 -exec ls -tl {} \; 
find /opt/app/logs/ -name *.log -mtime +5 -exec rm -f {} \;

For log files newer than 5 days
find /opt/app/logs/ -name *.log -mtime -5 -exec ls -tl {} \;
find /opt/app/logs/ -name *.log -mtime -5 -exec rm -f {} \;

Last Updated on Thursday, 16 April 2009 14:15
 
Valid XHTML & CSS | Template Design ah-68 | Copyright © 2009 by Firma
ankara escort escort ankara escort bayan bayan escort eskort bayan bursa escort escort bursa sex shop bursa escort escort bursa