Dienstag, 25. August 2015

Find and delete files older than X days (Linux Shell)

From time to time I need to clean certain folders from log files.

Here is a handy command that deletes files

  • in current folder 
  • that are older than 2 days
  • and that have the extension .log 

 find . -type f -mtime +2 -name '*.log' -exec rm {} \;

Keine Kommentare:

Kommentar veröffentlichen