@echo off rem update script to help maintain the intel documents repository rem it reads the file update.ins which contains update instruction lines rem each line is of the form rem cmd {sep} file [{sep} renamedFile] rem {sep} is one or more consecutive tabs or colons rem comments can be added after the final used argument if proceeded by a {sep} rem also blank lines and lines beginning with ; are ignored rem the first letter of cmd is one of (in upper or lower case) rem a add file to the repository rem u update file in the repository, the new file is in this directory (also acts as add) rem d delete the file from the repository rem r rename the file to renamedfile setlocal enabledelayedexpansion if not exist update.ins ( echo cannot locate update.ins goto :eof ) set C=dummy for /f "tokens=1,2,3 delims= :" %%A in (update.ins) do ( set cmd=%%A rem strip leading space from cmd and put ; to allow blank lines to be treated as comments set cmd=!cmd:* =!^; set cmd=!cmd:~0,1! if /I [!cmd!] == [a] ( if not exist "%%B" ( echo skipping add %%B ) else if exist "..\%%B" ( echo skipping add %%B del /F "%%B" >NUL ) else ( echo adding %%B move /Y "%%B" "..\%%B" >NUL ) ) else if /I [!cmd!] == [u] ( if not exist "%%B" ( echo skipping update %%B ) else ( if exist "..\%%B" (echo updating %%B) else (echo adding %%B) move /Y "%%B" "..\%%B" >NUL ) ) else if /I [!cmd!] == [d] ( if exist "..\%%B" ( echo deleting %%B del /F "..\%%B" >NUL ) else ( echo skipping delete %%B ) ) else if /I [!cmd!] == [r] ( if exist "..\%%B" ( echo renaming %%B %%C move /y "..\%%B" "..\%%C" >NUL ) else ( echo skipping rename %%B ) ) else if [!cmd!] neq [^;] ( echo bad update %%A ) )