Batch Script to archive the client archive folder

DRAFT - Script is being tested. Please post your comments or message me in discord.
You will need confidence in using Task Scheduler and creating an admin user for running tasks in the background.
Place the batch file in your folder
\Documents\My Games\Sid Meier's Civilization VI\Saves\Hotseat\pydt-archive

I have make a batch script to move the client save archives to sub folders.
The script could be updated to delete folders not archived-to since 3 months.

Here is the BEFORE

Here is the AFTER

Here is an example of ONE FOLDER
ScreenShot262

archive.bat

@echo off

set "sourceFolder=%~dp0"
set "extension=.Civ6Save"

echo SOURCE FOLDER: %sourceFolder%

cd /d "%sourceFolder%"

for %%F in (*%extension%) do (
    call :processFile "%%F"
)

goto :eof

:processFile
set "fullpath=%~1"
set "filename=%~nx1"
set "id=%filename:~0,8%"

echo MOVING FILE: "%filename%" TO FOLDER: "%id%" 

if not exist "%sourceFolder%\%id%\" (
	echo MKDIR: %id%
    mkdir "%sourceFolder%\%id%"
)

rem Generate a GUID using PowerShell
for /f "delims=" %%A in ('powershell "[guid]::NewGuid().ToString()"') do set "guid=%%A"

for %%F in ("%filename%") do set "filename_without_ext=%%~nF"

set "targetfile=%filename_without_ext%_%guid%%extension%"
move "%sourceFolder%\%filename%" "%sourceFolder%\%id%\%targetfile%"

goto :eof

Scheduled task

I have an another admin user called TaskAdmin. I use this to run batch files so they don’t pop open a window while I am using the computer.

ScreenShot258