This script is pretty simple and is used to handle the management of captured images. This makes the assumption that the name of the captured WIM file is the same as the name of the OS folder in which it goes.

The script will, be default, make a backup of the existing WIM in the destination folder (rename it to its date/time) before moving over the new version. This allows you to go and easily revert back to a previous capture. You should, periodically, go around and clean up old backups, however.

@echo off
setlocal
set DoBackup=1
if /i .%1.==.NOBACKUP. set DoBackup=0

pushd D:\DeploymentShare.ROOT\Captures
for %%i in (*.wim) do (
pushd "D:\DeploymentShare.ROOT\Operating Systems\%%~ni"
for %%j in (*.wim) do (
call :Rename "%%~dpnxj" "%%~tj"
)
popd
move %%i "D:\DeploymentShare.ROOT\Operating Systems\%%~ni\%%i"
)
popd

ROBOCOPY "D:\DeploymentShare.ROOT\Operating Systems" "D:\DeploymentMedia1\Content\Deploy\Operating Systems" *.wim /S /XD Sources EFI Boot Support

echo You should update your deployment disks now using the UpdateUSBDisk.ps1 script

goto :EOF

:Rename
echo %1
set RN=%2
set RN=%RN:/=-%
set RN=%RN: =_%
set RN=%RN::=-%
set RN=%RN:~1,-1%.bak
ren %1 %RN%
goto :EOF