Shell script House keeping/Ringout /Move/Remove file older than - day

** Myself 

#  Move file (BC_BC_XMB* filename) older than 100 day from /sapmnt/EPP/globle/ to /backup/BC_BC_XMB_ARCHIVE
find /sapmnt/EPP/global/BC_BC_XMB*  -type f -mtime +100 -exec mv {} /backup/BC_BC_XMB_ARCHIVE \;
#  Remove file older than 200 day in /backup/BC_BC_XMB_ARCHIVE
find /backup/BC_BC_XMB_ARCHIVE/BC_BC_XMB*  -type f -mtime +200 -exec rm {} \;

0 comments:

Loading