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



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