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

Re: Arglist too long...mv'ed crazy



On Sun, Apr 01, 2007 at 09:49:09AM -0700, Bart Schaefer wrote:
[...]
>   print -0 ../../cur/* | xargs -0 mv --target-directory=/back/up/folder
> 
> (Note xargs, not zargs, in the latter case.)

My zsh doesn't seem to have a -0 print option.

Maybe print -f '%s\0' ...

Also, you may want to use xargs -r0

It should be noted that xargs -0 is  GNU or BSD specific.

--target-directory is GNU specific.

> }     zargs --replace -- ../../cur/* -- mv {} /back/up/folder
> 
> That's probably the worst choice in this particular case because it
> will run "mv" once for each file, rather than once for each batch of
> as-many-files-will-fit.  

zmodload zsh/files and mv becomes a builtin, so the problem
disappears along with eventual compatibility issues and you can
even do:


mv ../../cur/* /back/up/folder

You can also speed things up with:

mv ../../cur/*(oN) /back/up/folder

to prevent zsh from sorting the files which may not be necessary
here.

-- 
Stéphane



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