Sunday, 24 November 2013

Purge N days older files in linux

find . -name "*.trc" -mtime +15 -exec ls -lrt {} \; -- list

find . -name "*.trc" -mtime +15 -exec rm -rf  {} \; -- remove


---# above commands will find in current directory and

---# all sub directories for files older than 15 days, with .trc 


find /home/oracle/ -name "*.log" -mtime +7 -exec ls -lrt {} \; --list

find /home/oracle/ -name "*.log" -mtime +7 -exec rm -rf {} \; --remove


---# above commands will find in /home/oracle/ directory and

---# all sub directories for files older than 7 days, with .log

No comments:

Post a Comment