Created
          May 2, 2014 13:27 
        
      - 
      
- 
        Save sathish-io/4732524fc46dffb79718 to your computer and use it in GitHub Desktop. 
    Linux - Find files that are older than 1 day
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Find files that are older than 1 day with file name 'LOGFILE', and delete them. | |
| find /var/log/ -type f -mtime +1 -name '*LOGFILE*' -exec rm {} \; | |
| We can put this delete command in a script say deleteOldLogs.sh and add it in cron entry to run every day, | |
| crontab -l | |
| 0 0 * * * /usr/sathish/Scripts/deleteOldLogs.sh | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment