From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20260 invoked by alias); 29 Sep 2016 09:51:54 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21991 Received: (qmail 28297 invoked from network); 29 Sep 2016 09:51:54 -0000 X-Qmail-Scanner-Diagnostics: from mail-qt0-f175.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.216.175):SA:0(0.0/5.0):. Processed in 0.322718 secs); 29 Sep 2016 09:51:54 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: mikachu@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.216.175 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GANnL4io9dai6cf30hS3H9tYad6tuvQFEEi57gPT9a0=; b=G3W70FpYUsfpkAhyYAt7mPVs+jPR0hrcqD8t5VepI/1YLzAEFByYe13rL5LNOmtsCp 4vycZ/oI6eyf4Pzi1ughvbAWIww6x8zp5nZwfyEWwOiowQsdc7l7W4Cq79wNTdKt1175 xv/wr53hiJIKP6lzcmrzIqtnzATKAAEQ6w/+p5kqknn0BoVpq//32utuUEfIJ+1iF8Ej h0G7l5uqsu0WJkVHc8LmJkKqGtuiGFH+vW6AL4tK9gAhbn9/BVtwknywg5MH6pJEnaw/ 8o7WHyAffsJF2IvQYNC0qY9b0AeYZit9pol3zD++ttGmjPVRt03y21jUu+FowL3H668g a7Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GANnL4io9dai6cf30hS3H9tYad6tuvQFEEi57gPT9a0=; b=mrd4rq8bflaX2G52p3BAKjAiQpRzVGMZMMt2C3f/bRLMJ9a1JW8DntFymT8lOfA5/2 BLIwVsXpFwK13T0oGtAy7PzYL1prsF04ltlDIzzQHbHRkMFjXPnxwOFWhVEj6G6Y3vUv XMUuD6wyaxBNgi3tDqw6I5FW/nkya+JbjM1/foOHq8kM6BfWK7vHuAgIqUOo5F3+lXd8 xhqV0iD0xrgQWpgq3LCbdvp7jw1XOEH+RZGHYkO3JHai3xontaR/zOlNrckBQCn9NK7L tJ85A8wAT7NQudKyNsMwMsE42nN0oDT9cQWMFNRLRwunq1eMrHyG84qDkupLtTOJoEPJ qtsA== X-Gm-Message-State: AA6/9RlDl1RwiOyedpr6MhaJxY2zyfcggWDtKxIo3qt3xmt/xq4C7DP24/KsgR0JBOhWk2xgePL9F0ZGqGM/0Q== X-Received: by 10.200.56.168 with SMTP id f37mr128864qtc.2.1475135653894; Thu, 29 Sep 2016 00:54:13 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <160929001853.ZM27784@torch.brasslantern.com> References: <160929001853.ZM27784@torch.brasslantern.com> From: Mikael Magnusson Date: Thu, 29 Sep 2016 09:54:13 +0200 Message-ID: Subject: Re: Filtering an array of file names To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On Thu, Sep 29, 2016 at 9:18 AM, Bart Schaefer wrote: > On Sep 29, 8:43am, Jesper Nygards wrote: > } > } Suppose I have an array of file names, generated from some external > } program. Is there an zsh-idiomatic way of filtering this array to only > } keep directories? > > Are these local file names that you can compare to the filesystem? If > so, you can use rc-expand-param and globbing qualifiers: > > directories=( ${^allfiles}(/) ) This should be directories=( ${^allfiles}(/N) ) unless you have nullglob set, otherwise it will either fail or fill up the directories array with entries like "foo(/)" depending on if nomatch is set. -- Mikael Magnusson