Gentoo Archives: gentoo-user

From: "Yuri K. Shatroff" <yks-uno@××××××.ru>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] look for a file type + sort
Date: Fri, 13 Sep 2013 13:51:45
Message-Id: 52331848.8030603@yandex.ru
In Reply to: Re: [gentoo-user] look for a file type + sort by Mark David Dumlao
1 On 13.09.2013 17:43, Mark David Dumlao wrote:
2 > On Fri, Sep 13, 2013 at 9:36 PM, Yuri K. Shatroff <yks-uno@××××××.ru> wrote:
3 >> On 13.09.2013 10:24, Jean-Christophe Bach wrote:
4 >> [ ... ]
5 >>
6 >>>
7 >>> This one should work:
8 >>>
9 >>> find /home/joseph/ -iname "*.pdf" -exec ls -l --sort=time {} +
10 >>
11 >>
12 >> -exec is not suitable here because it spawns a `ls` process per each found
13 >> entry; aside from being slow, this disallows sorting at all.
14 >
15 > This is incorrect. If you terminate exec with '+' instead of '\;', only a single
16 > instance of the command is run - the command line is built by appending
17 > each found file to the end of the {} placeholder.
18
19 Sorry, I'm ashamed
20 I didn't know about this feature. Does it also handle spaces correctly?
21
22 > The only reason I see for it to fail is if you have so many files that
23 > it can't be
24 > passed to the argv of the receiving command.
25
26 There's always an opportunity to use tempfiles ;)
27
28
29 --
30 Best wishes,
31 Yuri K. Shatroff

Replies

Subject Author
Re: [gentoo-user] look for a file type + sort Mark David Dumlao <madumlao@×××××.com>