41 lines
1.4 KiB
Batchfile
41 lines
1.4 KiB
Batchfile
@echo off
|
|
setlocal EnableExtensions EnableDelayedExpansion
|
|
|
|
set "rootDir=%CD%"
|
|
set "currentDir=%rootDir%\_CURRENT"
|
|
if not exist "%currentDir%" (
|
|
mkdir "%currentDir%" >nul 2>&1
|
|
if not exist "%currentDir%" (
|
|
echo ERROR: Cannot create "%currentDir%" (permission denied?).
|
|
echo Run the script with sufficient rights or choose a writable location.
|
|
exit /b 1
|
|
)
|
|
)
|
|
|
|
set "logFile=%currentDir%\_UpdateSequences.log"
|
|
echo [%date% %time%] === UpdateSequences run started in "%rootDir%" ===>> "%logFile%"
|
|
|
|
set "processedList=|"
|
|
|
|
for /f "delims=" %%D in ('dir /b /ad 2^>nul ^| findstr /R /I /B /E "daily_[0-9][0-9][0-9][0-9][0-9][0-9]" ^| sort /R') do (
|
|
if exist "%%D" (
|
|
for /f "delims=" %%S in ('dir /b /ad "%%D" 2^>nul') do (
|
|
set "notSeen=!processedList:|%%S|=!"
|
|
if "!notSeen!"=="!processedList!" (
|
|
echo [%%S] <= %%D
|
|
echo [%date% %time%] Sequence: "%%S" from daily: "%%D" >> "%logFile%"
|
|
set "src=%%D\%%S"
|
|
set "dst=%currentDir%\%%S"
|
|
set "srcLong=\\?\%rootDir%\%%D\%%S"
|
|
set "dstLong=\\?\%currentDir%\%%S"
|
|
robocopy "!srcLong!" "!dstLong!" /MIR /MT:32 /R:1 /W:1 /COPY:DAT /DCOPY:DAT /FFT /NFL /NDL /NP /NJH /NJS >> "%logFile%" 2>&1
|
|
set "processedList=!processedList!%%S|"
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
echo Done. Press any key to exit.
|
|
echo [%date% %time%] === UpdateSequences run completed ===>> "%logFile%"
|
|
pause >nul
|
|
exit /b 0 |