From: Dave B on
On Sunday 20 April 2008 12:21, Dave B wrote:

>> the true format is
>>
>> find files ... -switches
>
> Where did you read that? From the standard man page:
>
> find [ -H | -L ] path ... [ operand_expression ... ]

Ah ok, now I see what you mean. I never looked at "find" that way. Thanks!

--
D.

From: Dan Mercer on

"Dave B" <daveb(a)addr.invalid> wrote in message
news:fuf5f5$pes$1(a)registered.motzarella.org...
> On Saturday 19 April 2008 20:25, Dan Mercer wrote:
>
>>> time. If you mean how long since it was last modified, what you probably
>>> are looking for is:
>>>
>>> find . -maxdepth 1 -ctime +1 -name file
>>
>> You demonstrate a common misconception about find - that the format is
>>
>> find dir -switches ...
>>
>> the true format is
>>
>> find files ... -switches
>
> Where did you read that? From the standard man page:
>
> find [ -H | -L ] path ... [ operand_expression ... ]

find -H | -L are not standard find options - they may be Gnu find options,
but I've never seen them.
The synopsis for the standard find is

find path-name-list [expression]

Gnu find is a bit of a mess - if you're going to vary that far from the
original concept, maybe you
should reconsider renaming the program.

Dan Mercer

>
> --
> D.
>

From: Dave B on
On Sunday 20 April 2008 18:33, Dan Mercer wrote:

>> Where did you read that? From the standard man page:
>>
>> find [ -H | -L ] path ... [ operand_expression ... ]
>
> find -H | -L are not standard find options - they may be Gnu find options,
> but I've never seen them.
> The synopsis for the standard find is
>
> find path-name-list [expression]

Uhm, no. I copied/pasted that directly from the SUSv3 standard, so I suppose
that they *are* standard.

--
D.
From: Chris Mattern on
On 2008-04-20, SamL <slsamliu(a)gmail.com> wrote:
> On Apr 19, 6:18 am, Dave B <da...(a)addr.invalid> wrote:
>> On Saturday 19 April 2008 11:49, Joachim Schmitz wrote:
>>
>> >> If by "old" you mean how long has it been since it was created, you
>> >> can't (unless you save the information yourself) as UNIX doesn't
>> >> store file creation time. If you mean how long since it was last
>> >> modified, what you probably are looking for is:
>>
>> >> find . -maxdepth 1 -ctime +1 -name file
>> > But that's days, not hours.
>>
>> Then I guess we need some math:
>>
>> if [ $(( $(date +%s) - $(stat -c %Z file) )) -gt 3600 ]; then
>> ...
>> fi
>>
>> (or %Y instead of %Z if we want the modification time)
>>
>> Or, with GNU find (adapted from Ed's):
>>
>> find . -maxdepth 1 -cmin +60 -name file
>>
>> (or -mmin if we want the modification time), and test if the command outputs
>> something.
>>
>> All the above solutions need GNU tools. Not sure whether standard methods
>> exist for doing the same thing.
>>
>> --
>> D.
>
> I am using AIX and unfortunately do not have the stat command, so I
> tried the find command approach.
>
> It essentially works. Only one thing, it will return 0 even if there
> is no files found satisfying the criteria. So
>
> find . -maxdepth 1 -cmin +60 -name file >/tmp.$$
> [[ -s /tmp.$$ ]] && echo "old"
>
Look, Ma, no temp files!

[[ "$(find . -maxdepth 1 -cmin +60 -name file)" = "" ]] && echo "old"

--
Christopher Mattern

NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities
From: Kenny McCormack on
In article <slrng0pcl9.gg3.syscjm(a)sumire.gwu.edu>,
Chris Mattern <matternc(a)comcast.net> wrote:
....
>Look, Ma, no temp files!
>
>[[ "$(find . -maxdepth 1 -cmin +60 -name file)" = "" ]] && echo "old"

Let's count the minutes until one of the standards jockeys comes along
and tells you that that requies GNU tools...