My Script
log=$HOME/Deleted/$(date)
find $HOME/OldLogFiles/ -type f -mtime -7 -exec ls -latr {} \; -exec echo was deleted on `date` \; -exec rm -f "{}" \;|paste - - >> $log
My goal for the script is to delete files older than x amount of days and then log them to a file and display the filename, date deleted, and how old it was. I keep getting these errors however...
./test.sh: line 3: $log: ambiguous redirect
find: ‘ls’ terminated by signal 13
find: ‘ls’ terminated by signal 13
Anybody have any suggestions?
-aoption oflsis meaningless when applied to file argument(s). (ls –l .bashrcworks fine; you don’t need to sayls –la.) And the-tand-roptions are meaningful only when you have multiple arguments, or one (or more) directory argument. So, since you’re saying-type f, you might as well say just-exec ls -l {}. – Scott - Слава Україні Jun 29 '13 at 18:01