Wednesday, March 16, 2011

Find Command with Interval in Linux

If you would like to just find files between two dates in a directory in Linux, do the following:


$ touch f1 -t 201001011130
$ touch f2 -t 201012311130

The above will create two files f1 of date 01 Jan 2010 and f2 of 31 Dec 2010.

Now to find files between 01 jan 2010 to 31 dec 2010:

find . -cnewer f1 -and ! -cnewer f2

Hope that helps.





No comments: