Am 13.09.2013 08:24, schrieb Jean-Christophe Bach: > * Canek Peláez Valdés [13.09.2013. @00:16:51 -0500]: > >> On Fri, Sep 13, 2013 at 12:11 AM, Joseph wrote: >>> On 09/13/13 00:04, Canek Peláez Valdés wrote: >>>> >>>> On Thu, Sep 12, 2013 at 11:58 PM, Canek Peláez Valdés >>>> wrote: >>>>> >>>>> On Thu, Sep 12, 2013 at 11:48 PM, Joseph wrote: >>>>>> >>>>>> I want to list recursively certain type of files eg. *.pdf but I want to >>>>>> display: date, path and newest file first. >>>>>> >>>>>> What is the easiest way of doing it? >>>>> >>>>> >>>>> ls -l --sort=time "$(find /path -iname "*.pdf")" >>>>> >>>>> If there are no spaces in the filenames/directories, you can drop the >>>>> quotes from $(). >>>> >>>> >>>> Sorry, it doesn't work with spaces even with the quotes; if you don't >>>> have spaces in the directories/filenames, do >>>> >>>> ls -l --sort=time $(find /path -iname "*.pdf") >>>> >>>> If you have spaces, you need to set/restore IFS: >>>> >>>> S=${IFS}; IFS=$'\n'; ls -l --sort=time $(find . -iname "*.pdf"); IFS=${S} >>>> >>>> Regards. >>>> -- >>>> Canek Peláez Valdés >>>> Posgrado en Ciencia e Ingeniería de la Computación >>>> Universidad Nacional Autónoma de México >>> >>> >>> 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