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 B1F9A1381F3 for ; Fri, 13 Sep 2013 06:50:50 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 36018E0C52; Fri, 13 Sep 2013 06:50:46 +0000 (UTC) Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2B0EBE0A01 for ; Fri, 13 Sep 2013 06:50:45 +0000 (UTC) Received: from compute4.internal (compute4.nyi.mail.srv.osa [10.202.2.44]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id A8F4120487 for ; Fri, 13 Sep 2013 02:50:44 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Fri, 13 Sep 2013 02:50:44 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=binarywings.net; h=message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type; s=mesmtp; bh=BQzG/splz7GbXYsNjhHnY5JE ULQ=; b=QJpwmVOXCOahs2blU4UNRDo8KmnxYF1dYCfUSRMm4DnbB9e+hCrruUDi OHhSGQTdvRkUrDz+HC0r9q1KgxOrNnrh8IwSTzS26HQoGUGl/mX0O4bcI9LJTxh2 4d86kTNie1NurtZVN1s/9yx7bk5VxiD3B/q9Th0yLHlN47OMX44= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:date:from:mime-version:to :subject:references:in-reply-to:content-type; s=smtpout; bh=BQzG /splz7GbXYsNjhHnY5JEULQ=; b=r1rM8vMmclCz8jgE8oxEZjn31w1Mn/Z34Grm DtPLJJzNJtzAfTPEYNX0S3LgLg8o8aSxPgZsyEowdElPrZev65kpg/XpyytBFFeQ Ty+7/RCurhfPFBxv5NNPNOGyJ0gJrGmhweQQzh5Ql1KKdNbWVBtdJoWnywaltkkb MdgSnxM= X-Sasl-enc: wXgQGPkSW9E33X5M1QRRgyy2jngYsipksN00IUfDdpnm 1379055043 Received: from [10.118.200.136] (unknown [46.115.114.200]) by mail.messagingengine.com (Postfix) with ESMTPA id 91B4D6800A0 for ; Fri, 13 Sep 2013 02:50:43 -0400 (EDT) Message-ID: <5232B5AD.5070301@binarywings.net> Date: Fri, 13 Sep 2013 08:50:21 +0200 From: Florian Philipp User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130901 Thunderbird/17.0.8 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 To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] look for a file type + sort References: <20130913044830.GA4586@syscon7.inet> <20130913051148.GB4586@syscon7.inet> <20130913062401.GK6228@Morgoth> In-Reply-To: <20130913062401.GK6228@Morgoth> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="gorhlwppi1lQB6iVtAOLmXurWbVU40Vqr" X-Archives-Salt: 84c0c829-0fb4-4a6d-a54b-14be54104748 X-Archives-Hash: cb6d07ee102cfe4fa01145361cbaae15 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --gorhlwppi1lQB6iVtAOLmXurWbVU40Vqr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Am 13.09.2013 08:24, schrieb Jean-Christophe Bach: > * Canek Pel=C3=A1ez Vald=C3=A9s [13.09.2013. @00:16:= 51 -0500]: >=20 >> On Fri, Sep 13, 2013 at 12:11 AM, Joseph wrote: >>> On 09/13/13 00:04, Canek Pel=C3=A1ez Vald=C3=A9s wrote: >>>> >>>> On Thu, Sep 12, 2013 at 11:58 PM, Canek Pel=C3=A1ez Vald=C3=A9s >>>> wrote: >>>>> >>>>> On Thu, Sep 12, 2013 at 11:48 PM, Joseph wrot= e: >>>>>> >>>>>> I want to list recursively certain type of files eg. *.pdf but I w= ant to >>>>>> display: date, path and newest file first. >>>>>> >>>>>> What is the easiest way of doing it? >>>>> >>>>> >>>>> ls -l --sort=3Dtime "$(find /path -iname "*.pdf")" >>>>> >>>>> If there are no spaces in the filenames/directories, you can drop t= he >>>>> 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=3Dtime $(find /path -iname "*.pdf") >>>> >>>> If you have spaces, you need to set/restore IFS: >>>> >>>> S=3D${IFS}; IFS=3D$'\n'; ls -l --sort=3Dtime $(find . -iname "*.pdf"= ); IFS=3D${S} >>>> >>>> Regards. >>>> -- >>>> Canek Pel=C3=A1ez Vald=C3=A9s >>>> Posgrado en Ciencia e Ingenier=C3=ADa de la Computaci=C3=B3n >>>> Universidad Nacional Aut=C3=B3noma de M=C3=A9xico >>> >>> >>> Hm, I've tried: >>> ls -l --sort=3Dtime $(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. >> --=20 >> Canek Pel=C3=A1ez Vald=C3=A9s >=20 > Hi, >=20 > This one should work: >=20 > find /home/joseph/ -iname "*.pdf" -exec ls -l --sort=3Dtime {} + >=20 > Regards, >=20 > JC >=20 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 --gorhlwppi1lQB6iVtAOLmXurWbVU40Vqr Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlIytbEACgkQqs4uOUlOuU/58wCeId80VSqZWCVfX13UJ7PYVYOW RXIAnifmHmxS0iM06nfeMvNjFDFjcbmQ =ughc -----END PGP SIGNATURE----- --gorhlwppi1lQB6iVtAOLmXurWbVU40Vqr--