Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Find files that modified on yesterday recursively

SOLVED
Go to solution
yc_2
Regular Advisor

Find files that modified on yesterday recursively

Hi,

How to find files that had been modified on yesterday recursively?

Thanks ina advance,
YC
6 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Find files that modified on yesterday recursively

Hi:

See if this works for you (since 'find' recursively descends the directories in its path):

# cd
# find . -xdev -mtime +1 -print

See the man pages for 'find' for a complete explanation of these, and other, options.

...JRF...

federico_3
Honored Contributor
Solution

Re: Find files that modified on yesterday recursively

I would use the find command that recursively discends the directory hierarchy :

# cd DIR
# find . -mountstop -type f -mtime -1 -exec ll {} \;


Federico
Darrell Allen
Honored Contributor

Re: Find files that modified on yesterday recursively

Hi all,
Sorry to disagree but:

"find -mtime +n" selects files with a modification time > (n x 24) hours old.

"find -mtime -n" selects files with a modification time < (n x 24) hours old.

"find -mtime n" selects files with a modification time for the 24 hour period that begins (n x 24) hours in the past.

In all cases find uses the time when it runs as the point of reference.

For example:
"find . -mtime 0" will select all files modified within the previous 24 hours

"find . -mtime 1" will select all files modified within 24 - 48 hours ago

You cannot use find by itself to select the files modified yesterday because yesterday is from midnight to midnight and find is based on multiples of 24 hour periods from the time when it runs.

Further examples:

All files older than 1 week:
find -mtime +7

All files less than 1 week old:
find -mtime -7

All files that were modified more than 7 days but less than 8 days ago:
find . -mtime 7

Darrell
"What, Me Worry?" - Alfred E. Neuman (Mad Magazine)
MANOJ SRIVASTAVA
Honored Contributor

Re: Find files that modified on yesterday recursively

Hi Leong Yew Cheong

You may also try this:

ls -lR | awk '{ if ($6 == "Aug" && $7 == "14") ptint $NF,$6,$7 }' > /tmp/filelist

this will search the whole machine for the files created /modifued for that date. Please monitor /tmp in case there are more files.

All the best.

Manoj Srivastava
A. Clay Stephenson
Acclaimed Contributor

Re: Find files that modified on yesterday recursively

Hi:

To do this as stated you really need to find the files modified between local midnite and the previous midnite. Here is a perl script that does just that starting in the current directory and outputting all files modified yesterday.

Clay
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: Find files that modified on yesterday recursively

Hi again:

If you find that the 24-hour granularity of the 'mtime' argument to 'find' is not sufficiently fine for your needs, then you can use the 'newer' option of 'find'. Create a reference file with 'touch' choosing the date and time you need as your 'find' boundry point. You can use positive or negative logic. See the man pages for 'find' for further information.

Regards!

...JRF...