Running windows shell command

D

dfaroi

Hi all,

Sorry for my english, I'm french.

I have some problem running an xcopy command with paths that contains
spaces.
I'm trying that :
output = `cmd /c xcopy /r /y \"C:/Test A\" \"C:/Test B\"`

Xcopy doesn't return any error but don't transfer files from "Test A"
to "Test B".
If I rename those paths without spaces and double quotes, it works :
output = `cmd /c xcopy /r /y C:/TestA C:/Test B`

Could someone can explain this issue ?
Or can tell me a better way to do fast copy files under Windows and get
back a list of files tha was transfered ?

Copying files with ruby is less faster than running an xcopy command.
Is it always true ?

Thanks all for you're help to a french guy ;)

David
 
L

Logan Capaldo

Hi all,

Sorry for my english, I'm french.

I have some problem running an xcopy command with paths that contains
spaces.
I'm trying that :
output = `cmd /c xcopy /r /y \"C:/Test A\" \"C:/Test B\"`

Xcopy doesn't return any error but don't transfer files from "Test A"
to "Test B".
If I rename those paths without spaces and double quotes, it works :
output = `cmd /c xcopy /r /y C:/TestA C:/Test B`

Could someone can explain this issue ?
Or can tell me a better way to do fast copy files under Windows and
get
back a list of files tha was transfered ?

Copying files with ruby is less faster than running an xcopy command.
Is it always true ?

Thanks all for you're help to a french guy ;)

David

You may be 'over-escaping'. You shouldn't need to escape double-
quotes in backticks. What happens if you do:
output = `cmd /c xcopy /r /y "C:/Test A" "C:/Test B"`
 
B

Bill Guindon

Hi all,

Sorry for my english, I'm french.

It's better than my french ;)
I have some problem running an xcopy command with paths that contains
spaces.
I'm trying that :
output =3D `cmd /c xcopy /r /y \"C:/Test A\" \"C:/Test B\"`

As logan mentioned, you don't need to escape the double quotes.

You also don't need to call 'cmd /c', but you certainly can if you
like. I think that using it might actually hide the error, since
you're now getting the result of running 'cmd' and not of running
'xcopy'.

I _think_ the problem is the use of the '/' as the path separator. I
ran a few tests here, and it seems that can be interpreted by cmd as a
paramater flag (just as you are using the /c /r and /y flags). So try
changing the slash to backslash (which does need to be escaped) like
this:

output =3D `xcopy /r /y "C:\\Test A" "C:\\Test B"`
 
Y

yeman13

Actually I'm at working.

I will try and will keep you inform.

Thansk for your help Logan Capaldo and Bill Guindon.

Regards,

David from france
 
Y

yeman13

Commercial license for using rsync is too expensive.
That's why i'm searching for an other way to perform same thing by
myself.

Any other idea ?

David
 
D

dave

| Are you sure you can package rsync with a commercial product under GPL
| license ?

You can if:
1: It's not part of your work.
2: You redistribute the rsync code (or a written offert).


--
here are more things in heaven and earth,
horatio, than are dreamt of in your philosophy.


--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Sei in cerca dell’amore? Non perdere tempo, iscriviti gratis a Meetic! Potrai chattare con migliaia di single in linea.
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4052&d=10-3
 
S

Shad Sterling

------=_Part_5385_15335900.1142273982912
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
Content-Disposition: inline

T24gMy8xMS8wNiwgeWVtYW4xMyA8ZGZhcm9pQGdtYWlsLmNvbT4gd3JvdGU6Cj4KPiBUaGFua3Mg
Zm9yIHlvdXIgYW5zd2VyLgo+Cj4gSSdsbCB0cnkgdG8gc3R1ZHkgdGhpcyBwb3NzaWJpbGl0eS4K
Pgo+IEJ5ZS4KPgo+IERhdmlkCj4KPgo+CgpJIHVzZSB1bmlzb24gLQpodHRwOi8vd3d3LmNpcy51
cGVubi5lZHUvfmJjcGllcmNlL3VuaXNvbi9kb3dubG9hZC9yZWxlYXNlcy9zdGFibGUvdW5pc29u
LW1hbnVhbC5odG1sCkFzIGZhciBhcyBJIGtub3csIGl0J3MgdGhlIG9ubHkgc3luY3Jvbml6YXRp
b24gdG9vbCB0aGF0IGRvZXMgdHdvLXdheSBzeW5jLgpJdCdzIGFsc28gR1BMLCBzbyBpdCB3b3Vs
ZCBoYXZlIHRoZSBzYW1lIGxpY2Vuc2luZyBpc3N1ZXMgYXMgYW55IEdQTApzb2Z0d2FyZS4KCgot
LQoKU2hhZCBTdGVybGluZwptZUBzaGFkc3RlcmxpbmcuY29tCmh0dHA6Ly9zaGFkc3Rlcmxpbmcu
Y29tCg==
------=_Part_5385_15335900.1142273982912--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top