Quote:
Originally Posted by lweegp
This is my final script. Do u think it will work?
Thanks.
#! /bin/sh
Today_Date=`date +%Y%m%d`
mkdir /usr/TRS/backup/${Today_Date}
mv /usr/TRS/data/T* /usr/TRS/backup/${Today_Date}
find /usr/TRS/backup/. -name 'T*' -mtime +1 -exec rm -f {} \;
you can try it out by running the script..
if you want to make sure, then use the shell prompt and do it step by step and you can also list the files found first, before using the actual command
listing the files more than 10 days..
find /usr/TRS/backup/. -name 'T*' -mtime +10 -ls
i thought you want to delete directories more than 10 days?
find /usr/TRS/backup/. -name 'T*' -type d -mtime +10 -ls
Then once you are sure those files listed are the ones to delete, use the actual command , eg
find /usr/TRS/backup/. -name 'T*' -type d -mtime +10 -exec .....