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 |