zsh-users
 help / color / mirror / code / Atom feed
* ZSH Find command replacement
@ 2014-04-04 20:18 Aki Hoji
  2014-04-05  6:53 ` Daniel Shahaf
  0 siblings, 1 reply; 3+ messages in thread
From: Aki Hoji @ 2014-04-04 20:18 UTC (permalink / raw)
  To: zsh-users

Hi all,

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/ ; 

Thanks in advance. 

Aki

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ZSH Find command replacement
  2014-04-04 20:18 ZSH Find command replacement Aki Hoji
@ 2014-04-05  6:53 ` Daniel Shahaf
  2014-04-07  7:59   ` Michal Politowski
  0 siblings, 1 reply; 3+ messages in thread
From: Daniel Shahaf @ 2014-04-05  6:53 UTC (permalink / raw)
  To: Aki Hoji; +Cc: zsh-users

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 -- {} ... ;').


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ZSH Find command replacement
  2014-04-05  6:53 ` Daniel Shahaf
@ 2014-04-07  7:59   ` Michal Politowski
  0 siblings, 0 replies; 3+ messages in thread
From: Michal Politowski @ 2014-04-07  7:59 UTC (permalink / raw)
  To: zsh-users

On Sat,  5 Apr 2014 06:53:57 +0000, Daniel Shahaf wrote:
> 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 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 -- {} ... ;').

Actually it doesn't, as the paths find will give to mv will start with
'./' here, so any minus in a filename won't be at the start of an argument.

-- 
Michał Politowski
Talking has been known to lead to communication if practiced carelessly.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-04-07  8:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-04 20:18 ZSH Find command replacement Aki Hoji
2014-04-05  6:53 ` Daniel Shahaf
2014-04-07  7:59   ` Michal Politowski

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).