using find to list of file modification date for particular month

  • Follow


Hi All

Do you know how to using find to list of file modification date for
particular month ?

e.g.
list File created on 2010 Oct
list File created on 2010 Nov


moonhkt

0
Reply moonhkt 11/8/2010 9:08:16 AM

moonhkt <moonhkt@gmail.com> writes:

> Do you know how to using find to list of file modification date for
> particular month ?

Reading ‘find(1)’, especially the “TESTS” section, will tell you all
about the possible tests you can specify.

There you will see the ‘-mtime’ option documented; that's how you
specify a modification timestamp. Earlier, near the beginning of the
section, you'll see how to specify “less than N” and “greater than N”.
So that way, you can specify that files to be matched must have a
modification timestamp within a range.

Then it's up to you to calculate how many days ago each end of the range
you want is; perhaps use of ‘date(1)’ and some shell arithmetic could
help.

> e.g.
> list File created on 2010 Oct
> list File created on 2010 Nov

Earlier you asked about modification, but your examples talk about
creation. You should be aware that Unix filesystem usually don't store a
creation timestamp (and ‘find(1)’ has no way of querying it if it did
exist).

-- 
 \       “In the long run nothing can withstand reason and experience, |
  `\    and the contradiction which religion offers to both is all too |
_o__)                                        palpable.” —Sigmund Freud |
Ben Finney
0
Reply Ben 11/8/2010 9:22:48 AM


On 2010年11月08日 17:08, moonhkt wrote:
> Hi All
>
> Do you know how to using find to list of file modification date for
> particular month ?
>
> e.g.
> list File created on 2010 Oct
> list File created on 2010 Nov
>
>
> moonhkt
>
I think you should write a simple script to calculate the "hours" passed 
between now and your target date,then pass the "hours" as
a argument for -mtime option of find.

Kins.
0
Reply Kinsley 11/30/2010 11:29:00 AM

On 2010-11-30, Kinsley <ericchd@gmail.com> wrote:
> On 2010年11月08日 17:08, moonhkt wrote:
>> Hi All
>>
>> Do you know how to using find to list of file modification date for
>> particular month ?
>>
>> e.g.
>> list File created on 2010 Oct
>> list File created on 2010 Nov
>>
>>
>> moonhkt
>>
> I think you should write a simple script to calculate the "hours" passed 
> between now and your target date,then pass the "hours" as
> a argument for -mtime option of find.


Better - or easier - to write a script using touch to create 2 temp files
somewhere. Then use find to locate files with a date between those dates.

touch -t 201010010000 2010_10
touch -t 201011010000 2010_11
find ./ -file -newer 2010_10 ! -newer 2010_11 -exec echo '{}' ';'
 


-- 
When in doubt, use brute force.
                -- Ken Thompson
0
Reply Rikishi42 12/1/2010 12:30:42 AM

3 Replies
1193 Views

(page loaded in 0.392 seconds)

Similiar Articles:













7/21/2012 5:31:21 AM


Reply: