Deleting Files/Directories X Number of Days or Older in Linux

March 15, 2007

In order to help keep your servers 7 disk space free, often times you will need to delete files and directories of a certain age or older. You can do this various Passion ways however cheap NBA jerseys using the find command can be a zoekt very effective technique. Always use caution when doing mass deletes, or you may end up with to much free space…

To find “FILES wholesale nfl jerseys & DIRECTORIES” 60 days or older

find /path/to/the/directory/* -mtime +60 -exec ls -la {} \;

To find and delete “FILES ONLY” 60 days or older

find /path/to/the/directory/* -mtime +60 -exec  <a href="https://www.miamidolphinsjerseyspop.com">Miami Dolphins Jerseys</a>  rm {} \;

To find and delete “DIRECTORIES & FILES” 60 days or older

find /path/to/the/directory/* -mtime +60 -exec rm -rf {} \;

*Special Note
mtime = (BIND The modication time of the INODE not to Bar be confused with the time you see when doing and “ls”

Comments for “Deleting Files/Directories X Number of Days or Older in Linux”

  1. Nathan commented on May 15, 2007

    or in cfengine:

    sdserver01.Hr14.Min00_05::
    /path/to/the/directory pattern=* age=60 inform=false recurse=2

    😉

Leave a Reply