1:- using one Month
#ls -l |grep -i Jan |awk ' { print "rm " $9}' > sunil
#chmod 755 sunil
#./sunil
2:- using file name & month
#ls -l |grep -i "WF_LOG_*_*" |grep -i Jan |awk ' { print "rm " $9}' > sunil
#chmod 755 sunil
#./sunil
3:- For multiple months
# ls -l |grep -i "WF_LOG_*_*" |grep -i -e oct -e nov |awk ' { print "rm " $9}' > sunil
#chmod 755 sunil
#./sunil
4:- By modified time (300 days back) & multiple months between the dates.
#find /sapmnt/SRP/global -xdev -mtime +300 -type f -exec ll {} \; |grep -i "WF_LOG_*_*" |grep -i -e oct -e nov |awk ' { print "rm " $9}' > sunil
#chmod 755 sunil
#./sunil
5:- Delete file older than hours Example 2Hrs.
#touch -t 11281610 sun (Create a file for comparison)
# find /sapmnt/SRP/global -newer sun |awk ' { print "rm " $9}’
6:- Moving file by modified time
find /usr/sap/trans/log -xdev -mtime +700 -type f -exec ll {} \; | awk '{print "mv " $9 " /usr/sap/datatrans/" }' > sunil
Monday, February 8, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment