Why does robocopy confuse input and output files defined with Cygwin/bash and perl?
siegfried@heintze.com
siegfried@heintze.com
Wed Sep 30 14:54:00 GMT 2015
I sent this once and it did not appear in the list. Maybe I typed the
list name wrong?
I apologize if this appears twice.
I think the following code below should work (unfortunately, my email
program wants to wrap the code). The results of the echo
statement look fine! When I cut and paste the results of the echo, the
robocopy command works great!
OK! Now I want to automate it and instead of just displaying the
robocopy command with echo, actually execute it!
But why won't it execute directly?
For some reason, I get the errors below. Why is robocopy getting
confused on the input and output files?
Thanks
siegfried
src=$(perl -e '$u = $ENV{"USERNAME"};$s = $_ = $ARGV[0]; $_ =
lcfirst;s@[/\\]@\\\\@g; s@\s@\\ @g; s/(.):/$1\\:/; print " $_";
'"$(cygpath -w $PWD)")
dst=$(perl -e '$u = $ENV{"USERNAME"}; $_ = $ARGV[0]; $_ = lcfirst;
s@(/cygdrive/c|c:)[/\\]+Users[/\\]+$u([/\\]+Documents([/\\]+)?)?@f:\\backup\\unison\\@g;s@(c:\\cygwin(64)?)?[\\/]+home[\\/]+$u([\\/]+)?@f:\\backup\\unison\\HOME\\@g;s@[/\\]@\\\\@g;
s@\s@\\ @g; s/(.):/$1\\:/; print " $_"; $p="";foreach (split "[/\\\\]"){
$p = $p.$_."/"; mkdir $p unless -e $p } ' "$(cygpath -w $PWD)")
echo src=$src
echo dst=$dst
echo robocopy /s $src $dst
robocopy $src $dst
--- output from above commands:
src= c\:\\Users\\siegfried\\Documents\\bin
dst= f\:\\backup\\unison\\bin
robocopy /s c\:\\Users\\siegfried\\Documents\\bin
f\:\\backup\\unison\\bin
-------------------------------------------------------------------------------
ROBOCOPY :: Robust File Copy for Windows
-------------------------------------------------------------------------------
Started : Tuesday, September 29, 2015 7:53:04 PM
Source :
c:\Users\siegfried\Documents\bin\c\:\Users\siegfried\Documents\bin\
Dest : c:\Users\siegfried\Documents\bin\f\:\backup\unison\bin\
Files : *.*
Options : *.* /DCOPY:DA /COPY:DAT /R:1000000 /W:30
------------------------------------------------------------------------------
2015/09/29 19:53:04 ERROR 123 (0x0000007B) Accessing Source Directory
c:\Users\siegfried\Documents\bin\c\:\Users\siegfried\Documents\bin\
The filename, directory name, or volume label syntax is incorrect.
Compilation exited abnormally with code 16 at Tue Sep 29 19:53:04
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin
mailing list