Quantcast
Viewing all articles
Browse latest Browse all 11

Find and remove Files in Unix older than the specified number of days

For finding the files older than 31 days

find . -name “filename.ext” -mtime +no_of_days -exec ls -ltr {} ; e.g   find . -name “*req” -mtime +31 -exec ls -ltr {} ;

Verify the timestamp of all the files.They must be older than 5 weeks For Deleting files older that 31 days :

find . -name “*req” -mtime +31 -exec rm {} ;

Verify after execution of the above.

Execute:  find . -name “*req” -mtime +31 -exec ls -ltr {} ;


Viewing all articles
Browse latest Browse all 11

Trending Articles