Running windows shell command

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 :wink:

David

On Mar 7, 2006, at 5:08 PM, [email protected] wrote:

to “Test B”.

Thanks all for you’re help to a french guy :wink:

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"

On 3/7/06, [email protected] [email protected] wrote:

Hi all,

Sorry for my english, I’m french.

It’s better than my french :wink:

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\"

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 = xcopy /r /y "C:\\Test A" "C:\\Test B"

Actually I’m at working.

I will try and will keep you inform.

Thansk for your help Logan C. and Bill G…

Regards,

David from france

Thanks for your help.

After testing your sample code, it works.
I also add a /d parameter to only copy modified files.

Do you think that it’s the faster way to synchronize 2 directories ?

I’ll very appreciate an expert advise.

David

If you just want to synchronize 2 directories, in my experience
rsync is a good (fast) choice. It’s faster than using xcopy
when the 2 directories are similar.

http://www.samba.org/rsync/

rsync also comes with cygwin (unix for windows):
http://www.cygwin.com/

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

yeman13 wrote:

Do you think that it’s the faster way to synchronize 2 directories ?
I’ll very appreciate an expert advise.

You may want to have a look at
http://www.foldermatch.com/fmcompetitors.htm

Cristian Barbarosie http://cmaf.fc.ul.pt/~barbaros

“yeman13” [email protected] writes:

Commercial license for using rsync is too expensive.

rsync is GPL, you don’t need a license to use it in any way.

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

| 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

Thanks for your answer.

I’ll try to study this possibility.

Bye.

David

Thanks for the link. I will give a look this week end.

On 3/11/06, yeman13 [email protected] wrote:

I use unison -
http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html
As far as I know, it’s the only syncronization tool that does two-way
sync.
It’s also GPL, so it would have the same licensing issues as any GPL
software.

Shad Sterling
[email protected]
http://shadsterling.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs