Special With Command date, find,cp, grep and loop
#!/bin/bash
DATE=`date +%Y-%m-%d`
YEAR=`date +%Y`
THISMONTH=`date +%m`
LASTMONTH=`date +'%m' -d 'last month'`
DAYTH=`date +%d`
1 #. I want to restore all my email last 7 days by the following command:
Go to backup directory and type:
cd /opt/all-email-backup/
find . -mtime -7 -exec cp -p {} /home/vannak/email-restored/ \;
2 #. I want to restore all my email on April by the following command:
for i in `ls -lrt | grep "Apr" | awk '{print $9}' `; do cp -p $i* /home/vannak/april-email/April/; done
No comments:
Post a Comment