From: Florian Philipp <lists@binarywings.net>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] look for a file type + sort
Date: Fri, 13 Sep 2013 08:50:21 +0200 [thread overview]
Message-ID: <5232B5AD.5070301@binarywings.net> (raw)
In-Reply-To: <20130913062401.GK6228@Morgoth>
[-- Attachment #1: Type: text/plain, Size: 2105 bytes --]
Am 13.09.2013 08:24, schrieb Jean-Christophe Bach:
> * Canek Peláez Valdés <caneko@gmail.com> [13.09.2013. @00:16:51 -0500]:
>
>> On Fri, Sep 13, 2013 at 12:11 AM, Joseph <syscon780@gmail.com> 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 <caneko@gmail.com>
>>>> wrote:
>>>>>
>>>>> On Thu, Sep 12, 2013 at 11:48 PM, Joseph <syscon780@gmail.com> 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
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]
next prev parent reply other threads:[~2013-09-13 6:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-13 4:48 [gentoo-user] look for a file type + sort Joseph
2013-09-13 4:58 ` Canek Peláez Valdés
2013-09-13 5:04 ` Canek Peláez Valdés
2013-09-13 5:11 ` Joseph
2013-09-13 5:16 ` Canek Peláez Valdés
2013-09-13 6:24 ` Jean-Christophe Bach
2013-09-13 6:50 ` Florian Philipp [this message]
2013-09-13 12:45 ` Joseph
2013-09-13 13:36 ` Yuri K. Shatroff
2013-09-13 13:43 ` Mark David Dumlao
2013-09-13 13:51 ` Yuri K. Shatroff
2013-09-14 4:04 ` Mark David Dumlao
2013-09-14 19:16 ` Florian Philipp
2013-09-13 20:52 ` Alexander Kapshuk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5232B5AD.5070301@binarywings.net \
--to=lists@binarywings.net \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox