Wednesday, March 28, 2012

mtime or find old files or delete old files

If you want to find old files, i.e. find files greater that 30 days using following command

Find and Print Files:-
find -type f -name <'Search pattern*'> -mtime +30 -print

Delete files greater than 30 days:-(Time is important in this)
find /cba_app/WSSORD01/DEV/archive/outbound -name DLMASY* -mtime +30 -exec rm {} \;

Good site for reference
http://www.unix.com/tips-tutorials/20526-mtime-ctime-atime.html

No comments: