Created
May 8, 2012 11:36
-
-
Save alimbada/2634391 to your computer and use it in GitHub Desktop.
Copies one file over another if the two files are different.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
echo Comparing two files: %1 with %2 | |
if not exist %1 goto File1NotFound | |
if not exist %2 goto File2NotFound | |
fc %1 %2 | |
if %ERRORLEVEL%==0 GOTO NoCopy | |
echo Files are not the same. Copying %1 over %2 | |
copy %1 %2 /y & goto END | |
:NoCopy | |
echo Files are the same. Did nothing | |
goto END | |
:File1NotFound | |
echo %1 not found. | |
goto END | |
:File2NotFound | |
copy %1 %2 /y | |
goto END | |
:END | |
echo Done. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment