cancel
Showing results for 
Search instead for 
Did you mean: 

script help

 
jitjose
Advisor

script help

Hi,

I need help in deleting files from different folders older than x days, folder1, folder2, folder3... using a single script.

It should then log what has been removed from these folders and send an e-mail alert.

Can somebody please help me? Thanks in advance

1 REPLY
Dennis Handly
Acclaimed Contributor

Re: script help (find)

>I need help in deleting files from different folders older than x days, folder1, folder2, folder3

 

You should start with find, where $DAYS has your x days:

find directory1 directory2 directory3 -mtime +$DAYS > remove_list

rm -rf $(< remove_list)