I need to write a bash script that will do a find on files, delete each file it finds, wait a bit, then do the next. All this while logging to a file. I have the following script which I thought would work, but when I run it, I get:
sh: line 2: syntax error near unexp'cted token `do
sh: line 2: `do
Now I know the "find" syntax works, but some sort of problem with the "do" I guess. I am just not very good at bash :) Once i have this all up and working, I would like to schedule it to run weekly. Thanks!
for i in `find /pool1/comp1-backupexec -mtime +21 -name "B2D*"`
echo "$i" >> /pool1/comp1-backupexec/deletionlog.log