Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: is there a way to use *.{txt,zip,tbz,dmg} if one or more might be
- X-seq: zsh-users 24028
- From: "jdh" <dhenman@xxxxxxxxx>
- To: <zsh-users@xxxxxxx>
- Subject: Re: is there a way to use *.{txt,zip,tbz,dmg} if one or more might be
- Date: Sun, 07 Jul 2019 16:39:48 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=gmail.com; s=20161025;        h=to:subject:date:from:message-id;        bh=mcliY1Gln5Zq/EV8gLXbl6qySD8qKHhXe/sJ+gjIPdY=;        b=HosPtxOUcH+U9l+KAFDnunk+cLouNSE4kq5iNxACcI70KjVvowFB0Ydda5WBeoixlj         1UNm15CRNzQp7B2WOz9GPHw4vMvuZzMsbuZ57+2eDPaQgr3UcXLmhNU0bvESXAsXCK2B         cJIXu8FXS+gr12M1xgic5XrYQD0lQblzoYU1GKHtMuT89DpVq8NUIqyQeY8Yb3kYuzOV         OSq6kxtsFJrgxnyTWmq/fgLcrBsKsPzprGoUqDoJIg/9pOhLUI+Mb/TMPLmV7eaVJHot         JG2Mb7Fss9JqhuOrW4+CmmXBpMXebo31icG4uSV5lPdbvYAVTFqbGBNCPUpFiHaEeP/A         lclA==
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- List-unsubscribe: <mailto:zsh-users-unsubscribe@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
There shold be two ways to do that;
      1.)  Using extended flags
      	   	 setopt nullglob        # this will last throughout your session
or     2.) Add the 'N' flag like this:
      	         ls *.{txt,pdf,ods,odg,jpg}(N)   # this is on a singular basis
	You may need to prefix the 'N' like this (#QN) but I didn't have to.
       	         ls *.{txt,pdf,ods,odg,jpg}(#qN)
TJ Luoma <luomat@xxxxxxxxx> wrote:
> This seems like one of those things that I might have not learned that
> everyone else knows, so I thought I'd ask.
> 
> I can use this:
> 
>         mv -vn *.{txt,zip,tbz,dmg} ~/dir/
> 
> to move all files that end with zip/txt/tbz/dmg to ~/dir/
> 
> BUT it will fail if it does not find at least one file with each of
> those extensions.
> 
> Is there a way to do basically the same thing, but tell `mv` "if is at
> least one file with any of these extensions, then move to ~/dir/" ?
> 
> I suppose I could use `find` with various `-o` flags, but I was
> wondering if there was an easier way.
> 
> Thanks!
> 
> Tj
> 
> --
> TJ Luoma
> TJ @ MacStories
> Personal Website: luo.ma (aka RhymesWithDiploma.com)
> Twitter: @tjluoma
Messages sorted by:
Reverse Date,
Date,
Thread,
Author