delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/09/30/10:54:21

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-transfer-encoding:content-type
:message-id:from:to:subject:date:mime-version; q=dns; s=default; b=
LbE/BhZb20/u135OnBdxmYpbkkiQjOL9ci3fLzdmVMujMCwqe5Oxj7kEQsknKWVl
aXKUgld4MGkHn2Y4i/fK2plSQdNEXOpLjmFxhVxr8JIJJ5qzar9f6fTNnFPUG2IR
sCRNVmvA7bw8oMJVlIpNvJWNqczG8cMQC19JMuTEpnc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:content-transfer-encoding:content-type
:message-id:from:to:subject:date:mime-version; s=default; bh=JLH
TaynY/uTPGMdXx2XMpRQSxhs=; b=pXwidc+KxxGytyu52tdlP4MCDHp1FIEHuE5
vTm3Yu91/FUQXdgTLTEHGAdRDPnqsqVfEE3OO9ZWTpo7iYyKz2UB4fC1qHml/53e
ehWwCgcobsHj3f2E3NjIFS5eGm613H+P2r160W4eBZwOUe4alnLBWRdLLeaItR7Q
J3x1GySs=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: Yes, score=6.8 required=5.0 tests=AWL,BAYES_60,KAM_ASCII_DIVIDERS,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2
X-HELO: p3plwbeout11-06.prod.phx3.secureserver.net
X-SID: PSu31r0032YS96t01
User-Agent: Workspace Webmail 5.15.9
Message-Id: <20150930075400.d50bba72719f91cdb61cd892ddf83b25.788987e5cc.wbe@email11.secureserver.net>
From: <siegfried AT heintze DOT com>
To: cygwin AT cygwin DOT com
Subject: Why does robocopy confuse input and output files defined with Cygwin/bash and =?UTF-8?Q?perl=3F?=
Date: Wed, 30 Sep 2015 07:54:00 -0700
Mime-Version: 1.0
X-IsSubscribed: yes
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id t8UEsHAf007213

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019