Quantcast
Channel: linuxadmin: Expanding Linux SysAdmin knowledge
Viewing all articles
Browse latest Browse all 17822

Is there an easy way to delete all files matching a string created before a certain year?

$
0
0

Attempting to help a client clean up an old file server. It is running on a VERY old solaris box. They have a directory that stores daily files that has files going back to 2010. They would like to remove all files matching certain strings (ending in .CAB or beginning in MD10. ) that were created more than two years ago.

Short of manually sifting through thousands of files is there an easy way to achieve this on an old solaris box?

I was thinking something like

find /home/dats -name "*.CAB" -mtime +732 -exec rm -vf {}; find /home/dats -name "MD10*" -mtime +732 -exec rm -vf {}; 

Would that achieve what I want without deleting files that do not begin with MD10 or end with .CAB or etc?

submitted by chron67
[link][11 comments]

Viewing all articles
Browse latest Browse all 17822

Trending Articles