This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Checking XCOPY Exit Value in Cygwin Bash
Igor Peshansky wrote:
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).
Point taken. I will certainly look into it.
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.
Yeah I saw that reply and I had tried it. There were two problems.
1. New files will not be added to the build directory. It will say
something like
tar: ./Test/res/Test.manifest: Warning: Cannot stat: No such
file or directory
tar: Current `./Test/res/Test.manifest' is newer
and the required manifest file is not copied into the build
folder. So for the initial copy I have to
use it without the --keep-newer-files, and for the subsequent
copies I will have to use the --keep-newer-files.
2. This is the real problem. That is getting an indication whether
none of the files were updated or not. I want to proceed
with the rest of the building script only if more than one files have
been copied. I do not know how to get that using the tar
command. I tried echoing the $? value but it gives 0 all the time. The
source compiler can
detect if the sources were updated or not, on it's own, but
there are a lot of projects in one Visual Studio
Solution (about 60), that I can't wait until all those projects
have been parsed.
I am using
while read amount ; do
if [ ${amount::1} != "0" ]; then
copied=true;
fi
done < copy.log
for that purpose.
MSDN apparently lies. XCOPY for me returns non-zero on error, and 0 on
normal execution (no matter how many files were copied).
If that is the case, then there is no point in trying to check for the
xcopy return value.
As a short term solution I will stick with my original XCOPY solution.
But I will try to find out
what CVS, Make and the other tools have to offer. If there is a way of
getting if files have been replaced using the
tar command, I will try to implement that into my solution.
Although I am fairly competent at programming in C/C++, this is my first
attempt in writing a serious bash script,
and I must admit that I am both impressed and overwhelmed by it's power. :)
Thank you all for the help offered so far.
Regards
Shane
____________________________________________________________
GET FREE 5GB ONLINE STORAGE - Safely store your documents, photos and music online!
Visit http://www.inbox.com/storage to find out more!
--
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/