Find Syntax
Adam Nealis
adamnealis at yahoo.co.uk
Mon Jan 2 08:35:21 PST 2006
--- Drew Tomlinson <drew at mykitchentable.net> wrote:
> I'm trying to find all files with a modification time older than three
> weeks ago. In reading the find man page and searching Google, it seems
> the time returned by 'ls -l' is mtime. Thus I construct the following
> command:
>
> find . -not \( -newermt 3w \) -exec ls -l {} \;
find has -ls as a built-in, so no need to do -exec ls -l {} \;
I'm not sure what you mean by "-newermt" as a flag. Though "-newer mt"
would mean "newer than the file mt", in which case the "3w" part is not
appropriate.
Do these do what you need to?
find . -mtime +21 -ls
or
find -mtime +3w -ls
> But it returns files that are newer:
>
> -rw------- 1 nobody nobody 35292 Dec 29 08:43 totContactedRcvdPeers.rrd
> -rw------- 1 nobody nobody 35292 Dec 29 08:43 totContactedSentPeers.rrd
> -rw------- 1 nobody nobody 35292 Dec 29 08:33
> ./dc0/hosts/207/106/6/90/pktSent.rrd
>
> I've tried various placement of the '-not' and the )'s but I can't get
> it right. What am I missing?
>
> Thanks,
>
> Drew
__________________________________
Yahoo! for Good - Make a difference this year.
http://brand.yahoo.com/cybergivingweek2005/
More information about the freebsd-questions
mailing list