HuckleberryDBA

database musings and other technical stuff.

Thursday, November 5, 2015

Locate/Remove files older than (n) days

* using ctime  date-30
# test 
$ find /tmp/*.foo -depth -type d -ctime +30

# removal
$ find /tmp/*.foo -depth -type d -ctime +30 —exec rm {} \;


* using mtime date-15
# test
$ find /tmp/*.foo -depth -type f -mtime +15

# removal 
$ find /tmp/*.foo -depth -type f -mtime +15 -exec rm {} \;
Posted by Huckleberrydba at 5:15 PM
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2022 (7)
    • ►  December (1)
    • ►  April (1)
    • ►  January (5)
  • ►  2021 (5)
    • ►  December (4)
    • ►  February (1)
  • ►  2018 (1)
    • ►  November (1)
  • ►  2017 (1)
    • ►  December (1)
  • ▼  2015 (14)
    • ▼  November (14)
      • Monitor RMAN restore/recovery channels in progress.
      • Parse Oracle tnsnames.ora into alias list using Py...
      • How to resize/convert a Vagrant VMDK volume to VDI
      • Locate current SQL by user, Oracle non-RAC
      • Who is blocking who, Oracle non-RAC
      • Use sar to find point in time cpu usage
      • Redirect stdout to logfile
      • Kill all non-local Oracle processes
      • Shipping files with ftp, scp, and tar
      • Locate/Remove files older than (n) days
      • Recover a deleted file from an inode
      • Keep a scripted job from overlapping on itself
      • Oracle 12c Interactive Reference Tool
      • Setup Vagrant with VirtualBox
Simple theme. Powered by Blogger.