Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.unix.shell > #4504

Re: Find the oldest files without using ls -tr

From tmcd@panix.com (Tim McDaniel)
Newsgroups comp.unix.shell, comp.lang.perl.misc
Subject Re: Find the oldest files without using ls -tr
Date 2012-03-15 15:46 +0000
Organization Tim McDaniel's at Panix
Message-ID <jjt2s4$eru$1@reader1.panix.com> (permalink)
References <29316929-0f1b-466e-9041-3113bf4fe6c5@i5g2000yqo.googlegroups.com> <hov739-u091.ln1@anubis.morrow.me.uk> <jjsa1o$rhv$1@news.m-online.net> <0fu839-1k22.ln1@anubis.morrow.me.uk>

Cross-posted to 2 groups.

Show all headers | View raw


In article <0fu839-1k22.ln1@anubis.morrow.me.uk>,
Ben Morrow  <ben@morrow.me.uk> wrote:
>
>Quoth Janis Papanagnou <janis_papanagnou@hotmail.com>:
>> So I don't see where you are striving to with your argument. I think
>> your statement in your previous posting was just wrong.
>
>My point was that if you're going to feed perl from find it's better to
>do so with find -print0 and perl -n0 than with either xargs or find
>-exec {} +. Not only does it avoid any issues with argument length
>limitations,

The NetBSD version of "man find" may be more explicit than the man
page previously quoted (I can't check at the moment):

    If terminated by a plus sign (``+''), the pathnames for which the
    primary is evaluated are aggregated into sets, and utility will be
    invoked once per set, similar to xargs(1).  If any invocation
    exits with non-zero exit status, then find will eventually do so
    as well, but this does not cause find to exit early.  The string
    ``{}'' must appear, and must appear last.  Each set is limitted to
    no more than 5,000 pathnames, and is also limitted such that the
    invokation of utility does not exceed ARG_MAX.

So it appears to me that they've made an effort to make -exec work
like xargs in not blowing up on too-long command lines.

>it also runs perl in parallel with find rather than waiting.

I don't know of any reason why find couldn't run -exec in parallel,
but experimentally under NetBSD, it appears that it doesn't, so that
can be a valid objection.  ("Can be" because, on a low-powered system,
you might not want them to run in parallel, but there's no way to
avoid that with "|xargs".)

-- 
Tim McDaniel, tmcd@panix.com

Back to comp.unix.shell | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Find the oldest files without using ls -tr Paul Branon <paulbranon@googlemail.com> - 2012-03-13 08:22 -0700
  Re: Find the oldest files without using ls -tr Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-13 18:23 +0100
    Re: Find the oldest files without using ls -tr Ivan Shmakov <oneingray@gmail.com> - 2012-03-14 12:31 +0700
      Re: Find the oldest files without using ls -tr Paul Branon <paulbranon@googlemail.com> - 2012-03-14 08:28 -0700
        Re: Find the oldest files without using ls -tr Ivan Shmakov <oneingray@gmail.com> - 2012-03-14 22:43 +0700
          Re: Find the oldest files without using ls -tr Ben Morrow <ben@morrow.me.uk> - 2012-03-14 18:05 +0000
            Re: Find the oldest files without using ls -tr Sven Mascheck <mascheck@email.invalid> - 2012-03-14 18:31 +0000
              Re: Find the oldest files without using ls -tr Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-14 19:01 +0000
                Re: Find the oldest files without using ls -tr Ivan Shmakov <oneingray@gmail.com> - 2012-03-15 10:41 +0700
                Re: Find the oldest files without using ls -tr Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-15 08:13 +0000
                Re: Find the oldest files without using ls -tr Ivan Shmakov <oneingray@gmail.com> - 2012-03-16 10:24 +0700
                Re: Find the oldest files without using ls -tr Sven Mascheck <mascheck@email.invalid> - 2012-03-15 19:54 +0000
              Re: Find the oldest files without using ls -tr Ben Morrow <ben@morrow.me.uk> - 2012-03-14 19:59 +0000
                Re: Find the oldest files without using ls -tr Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-15 00:16 +0100
                Re: Find the oldest files without using ls -tr Ben Morrow <ben@morrow.me.uk> - 2012-03-15 02:12 +0000
                Re: Find the oldest files without using ls -tr Janis Papanagnou <janis_papanagnou@hotmail.com> - 2012-03-15 09:42 +0100
                Re: Find the oldest files without using ls -tr Ben Morrow <ben@morrow.me.uk> - 2012-03-15 10:56 +0000
                Re: Find the oldest files without using ls -tr tmcd@panix.com (Tim McDaniel) - 2012-03-15 15:46 +0000
                Re: Find the oldest files without using ls -tr Ben Morrow <ben@morrow.me.uk> - 2012-03-15 16:49 +0000
                Re: Find the oldest files without using ls -tr tmcd@panix.com (Tim McDaniel) - 2012-03-15 19:06 +0000
                Re: Find the oldest files without using ls -tr Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2012-03-15 17:13 +0000
  Re: Find the oldest files without using ls -tr Stephane Chazelas <stephane_chazelas@yahoo.fr> - 2012-03-13 17:40 +0000

csiph-web