This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Why does robocopy confuse input and output files defined with Cygwin/bash and perl?
- From: cyg Simple <cygsimple at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Thu, 1 Oct 2015 09:14:08 -0400
- Subject: Re: Why does robocopy confuse input and output files defined with Cygwin/bash and perl?
- Authentication-results: sourceware.org; auth=none
- References: <20150930075400 dot d50bba72719f91cdb61cd892ddf83b25 dot 788987e5cc dot wbe at email11 dot secureserver dot net> <560BFA8D dot 2050701 at cs dot umass dot edu> <7910682845 dot 20150930222746 at yandex dot ru>
On 9/30/2015 3:27 PM, Andrey Repin wrote:
> Greetings, Eliot Moss!
>
>> Dealing with "odd" characters like \ and such can be a pain, huh?
>> Perhaps it will help you to know that bash will expand variables
>> inside double-quoted arguments, i.e., "${src}". (You can write
>> "$src" if you want, but over the years I am finding it clearer /
>> better to use the { } to make clear the name of the variable I
>> want expanded.)
>
>> Also, you may find the cygpath utility helpful, and the $( ) idiom
>> of bash.
>
> It isn't "idiom of bash", it is a POSIX construction.
>
>> Thus:
>
>> robocopy /s "$(cygpath -w /cygdrive/c/Users/siegfriend/Documents/bin)" "$(cygpath -w
>> /cygdrive/f/backup/unison/bin)"
>
>> I believe this will do what you want. cygpath can be very helpful
>> hen you desire to run a Windows program from the cygwin environment.
>
> I would suggest cygpath -m.
Not for robocopy, it is likely not to survive / instead of \. I would
prefix it with "cmd /c" though or perhaps create a bash script called
robocopy to do the path conversion before calling the Windows
robocopy.exe. That way the command line looks typical.
--
cyg Simple
--
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