Find Files that are Modified Today (or Since Certain Time Ago) in Unix

To find all files that was modified since a specific time ago (i.e an hour ago, a day ago, 24 hours ago, a weeks ago and so on) in Unix environment, the find command will come in handy. The command syntax is:

To find all files modified in the last 24 hours (last full day) in current directory and its sub-directories:

find . -mtime -1 -print

Flag -mtime -1 option tells find command to look for files modified in the last day (24 hours). Flag -print option will cause find command to print the files’ location. -print can be replaced with -ls if you want a directory-listing-type response.

To find all files modified in the last 24 hours (last full day) in a particular specific directory and its sub-directories:

find /directory_path -mtime -1 -print

The command is basically the same with the earlier command, just that now you no need to cd (change directory) to the directory you want to search.

To find all files with regular file types only, and modified in the last 24 hours (last full day) in current directory and its sub-directories:

find /directory_path -type f -mtime -1 -print

To find all files that are modified today only (since start of day only, i.e. 12 am), in current directory and its sub-directories:

touch -t `date +%m%d0000` /tmp/$$
find /tmefndr/oravl01 -type f -newer /tmp/$$
rm /tmp/$$

The first command can be modified to specify other date and time, so that the commands will return all files that have changed since that particular date and time.


12 Responses to “Find Files that are Modified Today (or Since Certain Time Ago) in Unix”

  1. Mike
    June 30th, 2009 06:53
    12

    Question: If one does a find for files modified in the last two minutes, and it takes the command ten minutes to complete, is that going to fail completely?

  2. Bruno De Barros
    June 11th, 2009 15:46
    11

    @Kiran Kappeta, it works for me on Ubuntu. Try to see if it supports any non-integer values at all (for example, try 0.5 or 0.25). If it doesn’t, there’s your problem.

  3. Kiran Kappeta
    June 4th, 2009 21:02
    10

    Good one. Thanks.

    Tried

    find . -mtime -0.041666667 -print

    on Debian, it throws an error
    “find: invalid argument `-0.041666667′ to `-mtime’”

  4. Bruno De Barros
    June 4th, 2009 20:02
    9

    Additionally, to find files modified less than an hour ago:
    find . -mtime -0.041666667 -print

    Simply divide 1 by 24 (24 hours) and you’ll get what you want. For example, 0.1 is 2 hours and 24 minutes.

    I hope this helps whoever needs to find files modified LESS than one full day ago. :)

    —–
    Bruno De Barros

  5. Susmita
    May 14th, 2009 16:00
    8

    thanks a lot for the good article.

  6. Prabhakar
    February 20th, 2009 21:22
    7

    It was of timely help :)
    Thanks.

  7. RuBiCK
    December 12th, 2008 20:36
    6

    And how you will find files by specified hour?

    example. Files modified in last 8hours, if now, the time is 01AM

  8. Deiby
    November 12th, 2008 21:08
    5

    Thanks!!

  9. Recently Modified Files : mnavasca.ca
    October 1st, 2008 04:19
    4

    [...] be useful when I’m syncing files from our dev server to our production server. And thanks to this post I’ve finally found [...]

  10. Finding files modified since a certain time « Tech Notes @ Fernvale
    June 30th, 2008 11:46
    3

    [...] References: http://www.mydigitallife.info/2006/01/19/find-files-that-are-modified-today-or-since-certain-time-ag... [...]

  11. einstein
    May 7th, 2008 15:35
    2

    Very good article, thanx!

  12. iPAS
    August 4th, 2007 08:59
    1

    Great Thnks!

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

how to find a recent createdfile on unix - linux find files changed today - "find file by date" - find files created today - find modifies depuis - find the last modified file in linux - find latest files unix - find files changed last hour - find recently modified files windows - finding date wise file change eclipse - find command in unix to check the file time hours - how to search latest files modified - how to get the latest modified files in unix - how to find last change file unix - how to find last modified files in windows - linux last modified files - linux find changed files - linux search last modified file - linux search for files modified on specific date - linux recently modified files - linux find all files modified - linux check time modified - linux find files modified time - linux search file by date modified - ls -l show files of today - macintosh list all files changed today - recently modified files linux - UNIX how to find documents created after a specific data - unix find file tody - unix ls since - unix find last modified files - unix list recently modified files - unix find files changed in last 3 days - unix search last modified - unix list recently modified fiels - unix command to find files by date - unix commands find changed before date - unix find files from specific time - vista list all files edited today -