Gentoo Archives: gentoo-user

From: "Canek Peláez Valdés" <caneko@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] look for a file type + sort
Date: Fri, 13 Sep 2013 05:16:58
Message-Id: CADPrc8317DW403G1rZviiubQ3HWK343NO5KhFjd0wpq1X0kmpA@mail.gmail.com
In Reply to: Re: [gentoo-user] look for a file type + sort by Joseph
1 On Fri, Sep 13, 2013 at 12:11 AM, Joseph <syscon780@×××××.com> wrote:
2 > On 09/13/13 00:04, Canek Peláez Valdés wrote:
3 >>
4 >> On Thu, Sep 12, 2013 at 11:58 PM, Canek Peláez Valdés <caneko@×××××.com>
5 >> wrote:
6 >>>
7 >>> On Thu, Sep 12, 2013 at 11:48 PM, Joseph <syscon780@×××××.com> wrote:
8 >>>>
9 >>>> I want to list recursively certain type of files eg. *.pdf but I want to
10 >>>> display: date, path and newest file first.
11 >>>>
12 >>>> What is the easiest way of doing it?
13 >>>
14 >>>
15 >>> ls -l --sort=time "$(find /path -iname "*.pdf")"
16 >>>
17 >>> If there are no spaces in the filenames/directories, you can drop the
18 >>> quotes from $().
19 >>
20 >>
21 >> Sorry, it doesn't work with spaces even with the quotes; if you don't
22 >> have spaces in the directories/filenames, do
23 >>
24 >> ls -l --sort=time $(find /path -iname "*.pdf")
25 >>
26 >> If you have spaces, you need to set/restore IFS:
27 >>
28 >> S=${IFS}; IFS=$'\n'; ls -l --sort=time $(find . -iname "*.pdf"); IFS=${S}
29 >>
30 >> Regards.
31 >> --
32 >> Canek Peláez Valdés
33 >> Posgrado en Ciencia e Ingeniería de la Computación
34 >> Universidad Nacional Autónoma de México
35 >
36 >
37 > Hm, I've tried:
38 > ls -l --sort=time $(find /home/joseph -iname "*.jpg")
39 >
40 > got:
41 > ls: invalid option -- '/'
42
43 The exact same command (changing joseph with canek) works for me,
44 except in directories/filenames with spaces, as expected. Do you have
45 an alias for ls? What does find /home/joseph -iname "*.jpg" returns?
46
47 Regards.
48 --
49 Canek Peláez Valdés
50 Posgrado en Ciencia e Ingeniería de la Computación
51 Universidad Nacional Autónoma de México

Replies

Subject Author
Re: [gentoo-user] look for a file type + sort Jean-Christophe Bach <jc.bach@×××××××.org>