Kroko Just another WordPress weblog

November 10, 2014

Find files modified in the last week.

Filed under: Linux — admin @ 4:13 pm

Change ./ to the root directory you wish to search in. Change -7 to +7 for files changed more than a week ago.

  1. find ./ -mtime -7 -print

-mtime n[smhdw]

             If no units are specified, this primary evaluates to true if the difference between the file last modification time and the time find was started, rounded up to the next full 24-hour period, is n 24-hour periods.

             If units are specified, this primary evaluates to true if the difference between the file last modification time and the time find was started is exactly n units.

             Please refer to the -atime primary description for information on supported time units.

   -atime n[smhdw]

             If no units are specified, this primary evaluates to true if the difference between the file last access time and the time find was started, rounded up to the nextfull 24-hour period, is n 24-hour periods.

             If units are specified, this primary evaluates to true if the difference between the file last access time and the time find was started is exactly n units.  Possible time units are as follows:

             s       second

             m       minute (60 seconds)

             h       hour (60 minutes)

             d       day (24 hours)

             w       week (7 days)

             Any number of units may be combined in one -atime argument, for example, “-atime -1h30m”.  Units are probably only useful when used in conjunction with the + or   modifier.

Powered by WordPress