Reputation: 631
I've a directory structure which looks like this
main
-in
infile1.txt
infile2.txt
-out
outfile1.txt
outfile2.txt
-log
logfile1.txt
logfile2.txt
how can I delete files in all the sub directories which are 15 days old.
I know I can use following commands, but I want to do it using a single command.
find in/* -mtime +15 -exec rm {} \;
find out/* -mtime +15 -exec rm {} \;
find log/* -mtime +15 -exec rm {} \;
Upvotes: 1
Views: 115
Reputation: 1345
There is a Unix/Linux Stack Exchange...where I found this:
https://unix.stackexchange.com/questions/136804/cron-job-to-delete-files-older-than-3-days
Seems similar to what you are looking for.
Upvotes: 1