X-Spam-Check-By: sourceware.org Date: Sun, 6 Aug 2006 16:36:48 -0400 (EDT) From: Igor Peshansky Reply-To: cygwin AT cygwin DOT com To: Shane cc: cygwin AT cygwin DOT com Subject: Re: Checking XCOPY Exit Value in Cygwin Bash In-Reply-To: <44D62FDA.4010303@inbox.com> Message-ID: References: <44D62FDA DOT 4010303 AT inbox DOT com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT 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/