This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Checking XCOPY Exit Value in Cygwin Bash


On Mon, 7 Aug 2006, Shane wrote:

> What I am trying to do is, checkout the source to the build directory
> and if there are any local changes in my working directory copy them to
> the build directory, build and do a test run from there. This is so that
> I can test my code before I do the actual check in.

As David said, cvs has an easy way of doing this (using "cvs diff" and
"patch"), which will also deal with local and checked in changes to the
same file (while your method won't).

> To Igor,
>   Your method worked perfectly for paths with spaces too. :)

It was designed to. :-)

> Now if only I had a way of detecting if files were updated or not.

Did you happen to notice the mention of the "--keep-newer-files" tar
option in my original reply to you?  Just add that to the last "tar", and
you will only copy the files that were changed in your copy (presumably by
you) after the checked in version.

> To Mark
>   I tried it again. Unfortunately echo $? gives 0 for both the cases of,
> number of files copied = 0 and, greater than 0.
>   The link I posted from MSDN
> http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true
> says that XCOPY returns 1 when there were no files to be copied.

MSDN apparently lies.  XCOPY for me returns non-zero on error, and 0 on
normal execution (no matter how many files were copied).

> So I guess I am back to square one. :(

There are quite a few POSIX and Unix tools that are much better for this
job than xcopy.  I'd say investing some time in a Unix tutorial now would
save you more effort in the long run.
HTH,
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha@cs.nyu.edu | igor@watson.ibm.com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]