[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ls files that were modified on a certain date

From: Eric Blake
Subject: Re: ls files that were modified on a certain date
Date: Wed, 18 Jul 2012 14:10:19 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 07/18/2012 12:31 PM, Enda wrote:
> How do I list files that were modified on (or since) a certain date?

By using 'find'.  GNU findutils includes this example in its documentation:

       find $HOME -mtime 0

       Search for files in your home directory which have been modified
in the
       last twenty-four hours.  This command works this way because  the
       since  each  file  was  last  modified  is  divided by 24 hours
and any
       remainder is discarded.  That means that to match -mtime 0, a
file will
       have  to  have  a  modification in the past which is less than 24

Further questions on 'find' should be directed to the findutils list, as
this is not part of coreutils.  But if you need help figuring out how to
use $(()) and 'date' to do a shell computation of the value of the
argument to pass to find's -mtime flag, then this is the right place to
ask.  For example, finding files touched this year:

find -mtime $(( ( $(date +%s) - $(date -d 'Jan 1') ) / 24 / 60 / 60 ))

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]