On 09/13/13 08:50, Florian Philipp wrote:
[snip]

Hm, I've tried:
ls -l --sort=time $(find /home/joseph -iname "*.jpg")

got:
ls: invalid option -- '/'

The exact same command (changing joseph with canek) works for me,
except in directories/filenames with spaces, as expected. Do you have
an alias for ls? What does find /home/joseph -iname "*.jpg" returns?

Regards.
--
Canek Peláez Valdés

Hi,

This one should work:

find /home/joseph/ -iname "*.pdf" -exec ls -l --sort=time {} +

Regards,

JC


This won't work if there are too many files because find will eventually
start ls multiple times.

Try this instead:
find /path -iname '*.pdf' -printf '%T@\t%Tc\t%p\n' | sort -nr |
cut -f 2-

Regards,
Florian Philipp

They both work thank you! But Florian solution seems to work better eg.

Solution 1:
find /home/joseph/ -iname "*.jpg" -exec ls -l --sort=time {} + |more
-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
-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
...

Solution 2.
find /home/joseph -iname '*.jpg' -printf '%T@\t%Tc\t%p\n' | sort -nr | cut -f 
2- |more
Fri 30 Aug 2013 11:12:22 PM MDT /home/joseph/xp_share/img216.jpg
Tue 27 Aug 2013 05:18:56 PM MDT /home/joseph/Documents/albums/kuya_boy.jpg
Tue 27 Aug 2013 05:18:56 PM MDT /home/joseph/xp_share/kuya_boy.jpg
Tue 20 Aug 2013 10:31:29 PM MDT /home/joseph/0209C-SS_eyelets.jpg
Tue 20 Aug 2013 10:31:12 PM MDT /home/joseph/0210C.jpg
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
Wed 14 Aug 2013 05:16:13 PM MDT 
/home/joseph/business/Drawings/tolsink_devices/M8-AK120_3.4cm_c2c_32deg.jpg.jpg
...

The first solution did not find the first 5-files showing up in the Solution 2.

--
Joseph

Reply via email to