Pages

Monday, December 17, 2012

delete files older than x days linux



find . -name "*.trc" -mtime +35 -exec ls -lrt {} \; -- list
find . -name "*.trc" -mtime +35 -exec rm -rf  {} \; -- remove

---# above commands will find in current directory and
---# all sub directories for files older than 35 days, with .trc 


find /u01/ -name "*.log" -mtime +7 -exec ls -lrt {} \; --list
find /u01/ -name "*.log" -mtime +7 -exec rm -rf {} \; --remove

---# above commands will find in /u01/ directory and
---# all sub directories for files older than 7 days, with .log






No comments:

Post a Comment