DominikHoffmann
Registered
I currently have a cron job that clears out all files in a scratch directory that are older than 14 days:
I run it once every night, and it makes sure that this directory doesn't grow out of bounds.
I have played with the find command and have managed to print to STDOUT only those files that don't start with a period, because I would like to keep files like .DS_Store in place:
This commands also removes any file named "No Delete.txt" from the find output, which would result in its being spared deletion.
How do I properly sandwich the sed command into the -exec rm argument of my cron job?
Code:
find SomeDirectory -ctime +14 -print -exec rm -R {} \; > ~/Library/Logs/delete.log 2>&1
I run it once every night, and it makes sure that this directory doesn't grow out of bounds.
I have played with the find command and have managed to print to STDOUT only those files that don't start with a period, because I would like to keep files like .DS_Store in place:
Code:
find SomeDirectory -ctime +14 -print | sed -e '/No\ Delete.txt/d' -e '/\/\./d'
This commands also removes any file named "No Delete.txt" from the find output, which would result in its being spared deletion.
How do I properly sandwich the sed command into the -exec rm argument of my cron job?