This is an IIS website deployment script I started to write. It moves files from directory A to directory B and creates a log file with the date/time as the file name. When it's run in the AM hours, the time part of the log file name gets truncated because of the spaces. How can I fix this so it works for all times during the day (ie: 00.00.01, 00.00.11, 00.01.11, 00.11.11, 01.11.11 and 11.11.11 to give you some examples)? If you like "9"s then use 9s. Truncation occurs when we have 0s in the file name.. I think it treats it as a space. It's been a few months since I looked at this, but more critical projects came up and I put this aside. We just schedule the deployments in the evening for now. Haha! Essentially I want to use the least amount of IF statements as possible--but if you have a ton, I don't really care. If you have anything in your arsenal, awesome! :-) The script uses a "." (not a ":") for the time delimiters since colons aren't allowed in file names. If you're stumped, just say "MacGruber!" and take a drink of your diet Pepsi.
Prerequisites:
- You need to have the UI.Web folder created already
- You need the Robocopy.exe file in the path it expects
- You need a "logs" folder made before running script
REM **************************************************************
REM * TITLE: LIMS Deployment Script *
REM * AUTHOR: MacGyver *
REM * PURPOSE: Deployment Script for IIS Web Server Files *
REM * - include all files recursively *
REM * - excluded folders: .svn/obj *
REM * - excluded files: *.config, *.vb, *.cs, *.resx, *
REM * *.vbproj, *.user, *.suo, AND others *
REM * ASSUMES: UI.Web folder already exists *
REM **************************************************************
SET ROBOCOPY=".\robocopy.exe"
SET SOURCEDIR="\\tsclient\C\Source\websitename\UI.Web"
SET TARGETDIR="D:\web\docs\UI.Web"
SET DYYYY=%date:~-4,4%
SET DMM=%date:~-10,2%
SET DDD=%date:~-7,2%
SET THH=%time:~0,2%
SET TMM=%time:~3,2%
SET TSS=%time:~6,2%
REM - copy from one folder to another - the time doesn't work if you deploy the code in the AM, we need to fix that
%ROBOCOPY% %TARGETDIR% %TARGETDIR%_%DYYYY%-%DMM%-%DDD%_%THH%.%TMM%.%TSS% /S
REM - modify original folder with deployment changes & log the changes to a *.log file
%ROBOCOPY% %SOURCEDIR% %TARGETDIR% *.* /S /NP /XO /XD .svn obj /XF *.config *.vb *.cs *.resx *.vbproj *.user *.resources *.user *.suo > .\logs\Deployed_%DYYYY%-%DMM%-%DDD%_%THH%.%TMM%.%TSS%.log
iisreset