Reputation: 609
#!/bin/bash
NOW=$(date +"%Y-%m-%d-%H-%M-%S")
FILE="STUFF_2BeDeleted_$NOW.txt"
echo "Writing txt data to STUFF_2BeDeleted_$NOW.txt file, please wait..."
# rest of script
find /path/to/directory/stuffzMovin/ -type f -mmin +10 -print0 | xargs -0 ls -ltr > /path/to/directory/STUFF_2BeDeleted_$NOW.txt
mv -v /path/to/directory/stuffzMovin/* /path/to/directory/.hiddenStuffz/
i would probably use cron to run the above script, but i think there may be a better way because i would like to include this part
#rm -rf /path/to/directory/.hiddenStuffz
How can i make this happen every 2 weeks (#rm -rf /path/to/directory/.hiddenStuffz) just write it to another script and run that in cron also - or could i make this all happen in 1 script.
Upvotes: 0
Views: 65
Reputation: 1001
You can do this with your script. In your crontab :
When you use cron, you should take care to variable environments.
Upvotes: 1