I have searched everywhere but cannot find a solution. Im unsure what is going on here but I desperately need some help in regards to this issue, Im running a batch file (Script for a game Server monitor/crash restarter).
I decided to add a Log file Archival snippet which creates a folder named with the date and a subfolder named with the time then robocopy /mov the logs from the main folder to the archive folder that gets created each time the game server restarts (3hrs).
I tested the snippet on its own and in the rest of the batch script and it works fine, I also confirmed it to work in the task scheduler that the script is run from at server startup, however I notice that it may work once then the next time it needs to create the new directory and move the logs to the new date\time it gets moved to the previous date\time folder and doesnt make the new time directory, this is an example I use,
@echo off
set PROFILE=C:\GameServers\Server1\Profile
set SVR_LOGS=C:\GameServers\Server1\Profile\Logs\Archived_Logs
set ARC_FOLDER=%date:~10,4%_%date:~7,2%_%date:~4,2%\%time:~0,2%-%time:~3,2%-%time:~6,2%
echo Archiving Logs...
timeout 3 >nul
cd %SVR_LOGS%
mkdir %ARC_FOLDER%
robocopy *.log %PROFILE% %SVR_LOGS%\%ARC_FOLDER% /mov
robocopy *.adm %PROFILE% %SVR_LOGS%\%ARC_FOLDER% /mov
robocopy *.rpt %PROFILE% %SVR_LOGS%\%ARC_FOLDER% /mov
robocopy *.mdmp %PROFILE% %SVR_LOGS%\%ARC_FOLDER% /mov
cls
echo Log Archive Complete!...
timeout 3 >nul
cls
I have also tried other methods of doing this but it seems to do the same thing no matter which way I have it, game server host is a vm running server 2016 on dedicated server with server 2019 (Long story as to why that is dont worry, for short its for test purposes)