![]() |
Using FIND to locate files created between certain dates
Hello everyone,
I am trying to make a script that will locate all files files matching a particular name "*x*" that were created between two dates so that I can then grep them for a particular string. I am currently using this script: /bin/find ./ -ctime -31 -name "*x*" -exec /bin/cat {} ";" | /bin/grep y >> file but my requirements have changed so I can't look for files created between last month and today, but rather between two past dates. Thanks for any assistance! |
There is no creation time for a file in UNIX systems
instead you have : - time of last access - time of last modification - time of last status change You surelly want time of last modification which is mtime |
Er, yeah -ctime isn't creation time but changed time, sorry for the misunderstanding. I was looking at mtime but it still doesn't look like it will support a range of dates either, only from the past till now. I need it to find files changed/modified between two past dates. Thanks for replying.
|
You could use -newer file and you touch a file
with the most ancient date and the other as : 1st date : 1/6/2005 12:00 2nd : 12/7/2005 12:00 Code:
touch -t 200506011200 first |
Quote:
|
Quote:
|
find takes multiple selectors
e.g. find files that were modified yesterday: find . -mtime +1 -mtime -3 so, older than 1 day but younger than 3. Works with ctime, atime, mmin etc as well. I think that's your ticket. You can chain all kinds of selection statements like that. mlp |
All times are GMT -5. The time now is 12:00 PM. |