Find files in a date range?

Alex Janssen alex at ourwoods.org
Sat Jul 28 05:44:31 UTC 2007


Dave M said the following on 07/27/2007 08:19 PM:
> Is there a way to use 'find' to traverse a directory tree and print the 
> full paths to files in a date range? I can do:
>
> $find -L ~/PodCast -name *.mp3 -type f -printf "%h/%f\t%Ty%Tm%Td\n"
>
> to print the file names and modified dates but I also need to limit the 
> output to a range of modified dates. For example 070720 (July 20th 2007) to 
> 070727 (July 27th 2007).
>
> -------------------------------
> Dave M
> Davem (at) Mich (dot) Com
> Ann Arbor, Mich. USA
>
> Protect your digital rights: http://www.eff.org
> "The 'Analog Holes' they want to stop up are our eyes, ears and mouths."
>
>
>   
find -L ~/PodCast -name *.mp3 -mtime +60 -mtime -68 -type f -printf 
"%h/%f\t%Ty%Tm%Td\n"
This yields files greater than 60 days and less than 68 days old.
I don't see a way to specify dates.
Does bash do date math?  You could write a script to take dates as 
parameters and convert them to days ago for find.

Alex

-- 
Ourwoods.org
 Man who smoke pot choke on handle. - Uncle Chu (261)





More information about the ubuntu-users mailing list