Batch file to check if a file exists and raise an error if it doesn't
Posted
by cfdev9
on Stack Overflow
See other posts from Stack Overflow
or by cfdev9
Published on 2010-06-18T10:45:21Z
Indexed on
2010/06/18
11:33 UTC
Read the original article
Hit count: 309
batch-file
|bat
This batch file releases a build from TEST to LIVE. I want to add a check constraint in this file that ensures there is an accomanying release document in a specific folder.
"C:\Program Files\Windows Resource Kits\Tools\robocopy.exe" "\\testserver\testapp$"
"\\liveserver\liveapp$" *.* /E /XA:H /PURGE /XO /XD ".svn" /NDL /NC /NS /NP
del "\\liveserver\liveapp$\web.config"
ren "\\liveserver\liveapp$\web.live.config" web.config
So I have a couple of questions about how to achieve this...
There is a version.txt file in the \testserver\testapp$ folder and the only contents of this file is the build number (eg 45 - for build 45) How do I read the contents of the version.txt file into a variable in the batch file?
How do I check if a file \fileserver\myapp\releasedocs\ {build}.doc exists using the variable from part 1 in place of {build}?
© Stack Overflow or respective owner