From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 9E5571381F3 for ; Fri, 13 Sep 2013 12:45:03 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 9F1BDE0B5B; Fri, 13 Sep 2013 12:44:59 +0000 (UTC) Received: from mail119c7.megamailservers.com (mail119c7-2520.megamailservers.com [69.49.98.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 719EFE0B41 for ; Fri, 13 Sep 2013 12:44:58 +0000 (UTC) X-POP-User: admin.sys-concept.com Received: from syscon7.localdomain (S01060050da7ae68c.ed.shawcable.net [68.149.90.13]) by mail119c7.megamailservers.com (8.13.6/8.13.1) with ESMTP id r8DCiuhk011138 for ; Fri, 13 Sep 2013 08:44:57 -0400 Received: by syscon7.localdomain (Postfix, from userid 1000) id 0DF402040BD; Fri, 13 Sep 2013 06:45:08 -0600 (MDT) Date: Fri, 13 Sep 2013 06:45:08 -0600 From: Joseph To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] look for a file type + sort Message-ID: <20130913124507.GC4586@syscon7.inet> References: <20130913044830.GA4586@syscon7.inet> <20130913051148.GB4586@syscon7.inet> <20130913062401.GK6228@Morgoth> <5232B5AD.5070301@binarywings.net> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5232B5AD.5070301@binarywings.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-CSC: 0 X-CHA: v=1.1 cv=dE5LWfU0s3lPBeXNjWsXmXsYO56SZzstuuSX1PXHmQE= c=1 sm=1 a=wom5GMh1gUkA:10 a=u5azqbfQ5rEA:10 a=nDghuxUhq_wA:10 a=8nJEP1OIZ-IA:10 a=C3ZDv51cNVt4vJz/79I2xQ==:17 a=yrcI3KMHOqeZhvrQWhoA:9 a=wPNLvfGTeEIA:10 a=C3ZDv51cNVt4vJz/79I2xQ==:117 X-CTCH-Spam: Unknown X-CTCH-RefID: str=0001.0A020205.523308C9.012F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0 X-Archives-Salt: ee914bc1-ef86-4803-8f62-a0ad54576386 X-Archives-Hash: 0458fd70c725e98850eee3fd8c298186 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