Using this post "How to get UTC time with windows batch file" I've created a script that date and time stamps some directories for me when doing stuff...
REM *** Get time in UTC format, and set to variable called dame
for /f %%x in ('wmic path win32_utctime get /format:list ^| findstr "="') do set %%x
set dame=%Year%-%Month%-%Day%_%Hour%-%Minute%
set rundir=%dame%
mkdir %rundir%
There are other parts to my script, but it basically creates a directory structure as follows:
2018-3-22_14-10 (parent folder)
|- Sun_2018-3-22_14-10 (sub folder)
|- Sat_2018-3-22_14-10 (sub folder)
|- Fri_2018-3-22_14-10 (sub folder)
|- Thu_2018-3-22_14-10 (sub folder)
etc.
I am in the UK and I have some testing to do this weekend when GMT changes to BST. I will be using Task Scheduler to run my script every 5 or 10 minutes.
My question is as follows; say the script created a directory like thus this weekend:
2018-3-25_00-55 (parent folder)
|- Sun_2018-3-25_00-55 (sub folder)
|- Sat_2018-3-25_00-55 (sub folder)
|- Fri_2018-3-25_00-55 (sub folder)
|- Thu_2018-3-25_00-55 (sub folder)
etc.
That is, a run on Sunday 25th Mar at 00:55.
BST begins at 01:00 on Sunday 25th Mar. Will my folders be overwritten?
I do not think this will be the case for two reasons:
1) The clocks are going forward, so the next parent folder I would see would be "2018-3-25_02-00" worst case scenario and nothing over-written?
2) However, I'm using UTC, from wmic, as opposed to the local server time to get date/time. So the local time recorded would be 02:00 (UTC+1hr). As I am using UTC, the folder creation should stay at UTC+0hrs, and therefore the next parent folder I would see would be "2018-3-25_01-00"?
Following this logic, when BST returns to GMT again, I should not have to worry about over-writes as UTC should not change?