Showing posts with label cleanup files. Show all posts
Showing posts with label cleanup files. Show all posts

Tuesday, March 15, 2016

Linux os level backup and cleanup cmds

REMOVE ALL FILES OLDER THAN 15 DAYS:

[oracle@Linux01 dpump]$
find /u01/app/oracle/dpump/*.dmp -mtime +15 -exec rm {} \;


GZIP ALL FILES OLDER THAN 15 DAYS: (This will make individual GZIP files)

[oracle@Linux01 dpump]$
find /u01/app/oracle/dpump/*.dmp -mtime +90 -exec gzip {} \;


MOVE FILES OLDER THAN 15DAYS

find /home/arvind -maxdepth 1 -iname "*.txt" -mtime -15 -exec mv {} /home/arvind/test1/ \;


COUNT FILES OLDER THAN 90 DAYS

find /u01/app/oracle/admin/adump/*.aud -mtime +90 | exec wc -l {} \;


TAR ALL FILES OLDER THAN 15 DAYS: 
(This will make 1 TAR FILE With date format at end)

[oracle@Linux01 dpump]$

find /u01/app/oracle/admin/ORCL/adump/*.aud -mtime +90 | xargs  tar -czvPf  /u01/app/oracle/admin/ORCL/adump/ARCH_AUD_$(date +%F).tar.gz