Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: ZSH Find command replacement



Aki Hoji wrote on Fri, Apr 04, 2014 at 16:18:58 -0400:
> recently switched to ZSH.  I have a quick question.  What is the shortest ZSH command equivalent of a following command ? 
> 
> find . -ctime -1 -type d -exec mv {} /foo/ ; 

I'd start with:

    echo mv -- *(/ch-1) /foo/

The *(...) syntax is documented in "Glob Qualifiers" in zshexpn(1).  The
'c' restricts ctime to the last 1 hour to and the '/' restricts to directories.

I added a '--' for safety (in case a filename begins with a minus),
but that's not specific to zsh; the 'find' version needs it too
(as in, '-exec mv -- {} ... ;').



Messages sorted by: Reverse Date, Date, Thread, Author