Tuesday, October 09, 2012

Examples of Finding then Deleting in LInux

Delete files in linux older than 1 year:

find  /u01 -type f -mtime +365 -ls -exec rm -f -- {} \;

Delete files in linux in last 3 days:

find  /u01 -type f -mtime -3 -ls -exec rm -f -- {} \;

Delete folders in linux older than 1 year:

find  /u01 -type d -mtime +365 -ls -exec rm -rf -- {} \;

Delete trace files in linux older than 2 days

find  .  -type f   -name "*.tr*"  -mtime +2 -ls -exec rm -f -- {} \;

No comments: