Sunday, July 15, 2018

Command to find files with same extn and delete if age of file greater than 720 mins

Below Command is use full to find all .log files and delete if age of log file greater than 720 mins

find $HOME -name *.log -type f -mmin +720 -delete

Command to find file names suppose Test.log.9 or Test.log.19

find $HOME -name "*.log.[1-9][0-9]*" -type f -mmin +720 -delete
find $HOME -name "*.log.[2-9]*" -type f -mmin +720 -delete

No comments:

Post a Comment