1 |
Am 13.09.2013 08:24, schrieb Jean-Christophe Bach: |
2 |
> * Canek Peláez Valdés <caneko@×××××.com> [13.09.2013. @00:16:51 -0500]: |
3 |
> |
4 |
>> On Fri, Sep 13, 2013 at 12:11 AM, Joseph <syscon780@×××××.com> wrote: |
5 |
>>> On 09/13/13 00:04, Canek Peláez Valdés wrote: |
6 |
>>>> |
7 |
>>>> On Thu, Sep 12, 2013 at 11:58 PM, Canek Peláez Valdés <caneko@×××××.com> |
8 |
>>>> wrote: |
9 |
>>>>> |
10 |
>>>>> On Thu, Sep 12, 2013 at 11:48 PM, Joseph <syscon780@×××××.com> wrote: |
11 |
>>>>>> |
12 |
>>>>>> I want to list recursively certain type of files eg. *.pdf but I want to |
13 |
>>>>>> display: date, path and newest file first. |
14 |
>>>>>> |
15 |
>>>>>> What is the easiest way of doing it? |
16 |
>>>>> |
17 |
>>>>> |
18 |
>>>>> ls -l --sort=time "$(find /path -iname "*.pdf")" |
19 |
>>>>> |
20 |
>>>>> If there are no spaces in the filenames/directories, you can drop the |
21 |
>>>>> quotes from $(). |
22 |
>>>> |
23 |
>>>> |
24 |
>>>> Sorry, it doesn't work with spaces even with the quotes; if you don't |
25 |
>>>> have spaces in the directories/filenames, do |
26 |
>>>> |
27 |
>>>> ls -l --sort=time $(find /path -iname "*.pdf") |
28 |
>>>> |
29 |
>>>> If you have spaces, you need to set/restore IFS: |
30 |
>>>> |
31 |
>>>> S=${IFS}; IFS=$'\n'; ls -l --sort=time $(find . -iname "*.pdf"); IFS=${S} |
32 |
>>>> |
33 |
>>>> Regards. |
34 |
>>>> -- |
35 |
>>>> Canek Peláez Valdés |
36 |
>>>> Posgrado en Ciencia e Ingeniería de la Computación |
37 |
>>>> Universidad Nacional Autónoma de México |
38 |
>>> |
39 |
>>> |
40 |
>>> Hm, I've tried: |
41 |
>>> ls -l --sort=time $(find /home/joseph -iname "*.jpg") |
42 |
>>> |
43 |
>>> got: |
44 |
>>> ls: invalid option -- '/' |
45 |
>> |
46 |
>> The exact same command (changing joseph with canek) works for me, |
47 |
>> except in directories/filenames with spaces, as expected. Do you have |
48 |
>> an alias for ls? What does find /home/joseph -iname "*.jpg" returns? |
49 |
>> |
50 |
>> Regards. |
51 |
>> -- |
52 |
>> Canek Peláez Valdés |
53 |
> |
54 |
> Hi, |
55 |
> |
56 |
> This one should work: |
57 |
> |
58 |
> find /home/joseph/ -iname "*.pdf" -exec ls -l --sort=time {} + |
59 |
> |
60 |
> Regards, |
61 |
> |
62 |
> JC |
63 |
> |
64 |
|
65 |
This won't work if there are too many files because find will eventually |
66 |
start ls multiple times. |
67 |
|
68 |
Try this instead: |
69 |
find /path -iname '*.pdf' -printf '%T@\t%Tc\t%p\n' | sort -nr | |
70 |
cut -f 2- |
71 |
|
72 |
Regards, |
73 |
Florian Philipp |