Delete files in Linux older than x days and x min

Move files/archive logs to backup folder, files older than 1 day

find /rman/arch/*.dbf -mtime +1 -exec mv {} /rman/archbkp/ \;

Move files older than 25hours

find /rman/arch/*.dbf -mmin +1500 -exec mv {} /rman/archbkp/ \;

List files older than 2hours
find /rman/arch/*.dbf -mmin +120 -exec ls -ltr {} \;

Delete files older than 1 day
find /rman/arch/*.dbf -mtime +1 -exec rm {} \;

Delete files older than 1 hours
find /rman/arch/*.dbf -mmin +60 -exec rm {} \;

 

Advertisements

About Sher khan

Senior Oracle DBA, Oracle 10g , Oracle 11g OCE ,Oracle 12C and Oracle 11g OPN certified Specialist, OCP Certified in Oracle 9i,10g , 11g and 12C. I am working in Oracle technology since 2004. Currently working in U.A.E Email: sher487@hotmail.com
This entry was posted in Linux commands for DBA. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s