1 |
On 09/13/13 08:50, Florian Philipp wrote: |
2 |
[snip] |
3 |
>>>> |
4 |
>>>> Hm, I've tried: |
5 |
>>>> ls -l --sort=time $(find /home/joseph -iname "*.jpg") |
6 |
>>>> |
7 |
>>>> got: |
8 |
>>>> ls: invalid option -- '/' |
9 |
>>> |
10 |
>>> The exact same command (changing joseph with canek) works for me, |
11 |
>>> except in directories/filenames with spaces, as expected. Do you have |
12 |
>>> an alias for ls? What does find /home/joseph -iname "*.jpg" returns? |
13 |
>>> |
14 |
>>> Regards. |
15 |
>>> -- |
16 |
>>> Canek Peláez Valdés |
17 |
>> |
18 |
>> Hi, |
19 |
>> |
20 |
>> This one should work: |
21 |
>> |
22 |
>> find /home/joseph/ -iname "*.pdf" -exec ls -l --sort=time {} + |
23 |
>> |
24 |
>> Regards, |
25 |
>> |
26 |
>> JC |
27 |
>> |
28 |
> |
29 |
>This won't work if there are too many files because find will eventually |
30 |
>start ls multiple times. |
31 |
> |
32 |
>Try this instead: |
33 |
>find /path -iname '*.pdf' -printf '%T@\t%Tc\t%p\n' | sort -nr | |
34 |
>cut -f 2- |
35 |
> |
36 |
>Regards, |
37 |
>Florian Philipp |
38 |
|
39 |
They both work thank you! |
40 |
But Florian solution seems to work better eg. |
41 |
|
42 |
Solution 1: |
43 |
find /home/joseph/ -iname "*.jpg" -exec ls -l --sort=time {} + |more |
44 |
-rw-r--r-- 1 joseph users 113350 Aug 16 20:11 /home/joseph/business/Drawings/tolsink_devices/Fostex-HP-P1_to_Ibasso-D12_2.6cm_c2c_69deg.jpg |
45 |
-rw-r--r-- 1 joseph users 175335 Aug 14 17:16 /home/joseph/business/Drawings/tolsink_devices/M8-AK120_3.4cm_c2c_32deg.jpg.jpg |
46 |
... |
47 |
|
48 |
Solution 2. |
49 |
find /home/joseph -iname '*.jpg' -printf '%T@\t%Tc\t%p\n' | sort -nr | cut -f 2- |more |
50 |
Fri 30 Aug 2013 11:12:22 PM MDT /home/joseph/xp_share/img216.jpg |
51 |
Tue 27 Aug 2013 05:18:56 PM MDT /home/joseph/Documents/albums/kuya_boy.jpg |
52 |
Tue 27 Aug 2013 05:18:56 PM MDT /home/joseph/xp_share/kuya_boy.jpg |
53 |
Tue 20 Aug 2013 10:31:29 PM MDT /home/joseph/0209C-SS_eyelets.jpg |
54 |
Tue 20 Aug 2013 10:31:12 PM MDT /home/joseph/0210C.jpg |
55 |
Fri 16 Aug 2013 08:11:59 PM MDT /home/joseph/business/Drawings/tolsink_devices/Fostex-HP-P1_to_Ibasso-D12_2.6cm_c2c_69deg.jpg |
56 |
Wed 14 Aug 2013 05:16:13 PM MDT /home/joseph/business/Drawings/tolsink_devices/M8-AK120_3.4cm_c2c_32deg.jpg.jpg |
57 |
... |
58 |
|
59 |
The first solution did not find the first 5-files showing up in the Solution 2. |
60 |
|
61 |
-- |
62 |
Joseph |