?

Log in

No account? Create an account

Previous Entry | Next Entry

Find all files between two dates

To print all the files from 19-10-2007 to 21-11-2007

$ find <DIR> -type f -exec ls -l --time-style=full-iso  {} \; | awk '{print $6,$NF}' | awk '{gsub(/-/,"",$1);print}' | awk '$1>= 20071019 && $1<= 20071121 {print $2}'

And to print all files from 2nd Nov 2007 to today, (Using -mtime with find command, and calculating the mtime based on the epoch times.)

$ FROM=`date --date='11/2/2007' +%s`
$ TO=`date +%s`


$ find /home/jsaikia/harness/rough/ -type f -mtime -`echo "(((($TO - $FROM ) / 24) / 60) / 60)" | bc`  -print

If anyone got any better idea, please put in the comment section below.

Profile

jaduks
Jadu Kumar Saikia

Latest Month

January 2008
S M T W T F S
  12345
6789101112
13141516171819
20212223242526
2728293031  
Powered by LiveJournal.com
Designed by chasethestars