Running windows shell command


#1

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


#2

On Mar 7, 2006, at 5:08 PM, removed_email_address@domain.invalid 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"


#3

On 3/7/06, removed_email_address@domain.invalid removed_email_address@domain.invalid 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"


#4

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


#5

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


#6

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/


#7

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


#8

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


#9

“yeman13” removed_email_address@domain.invalid writes:

Commercial license for using rsync is too expensive.

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


#10

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


#11

| 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


#12

Thanks for your answer.

I’ll try to study this possibility.

Bye.

David


#13

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


#14

On 3/11/06, yeman13 removed_email_address@domain.invalid 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
removed_email_address@domain.invalid
http://shadsterling.com