Created
August 17, 2023 20:34
-
-
Save froschgrosch/4558a2ada182c9e79e6e19ee0bc6aa03 to your computer and use it in GitHub Desktop.
A script for reconstructing the correct time stamp in the explorer from the demo file name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# VQ3 style - demo-\d{8}-\d{6}\.dm_68 | |
# RA3 style - \w*_\d{8}_\d{6}\.dm_68 | |
# Q3E style - \d{14}-\S*-\w*\.dm_68 | |
foreach ($file in Get-ChildItem){ | |
if ($file.Name -match '\w*_\d{8}_\d{6}\.dm_68'){ | |
Write-Output $file.Name | |
$date = $file.Name.Split('_') | |
$date = Get-Date -Year $date[1].Substring(0,4) -Month $date[1].Substring(4,2) -Day $date[1].Substring(6,2) -Hour $date[2].Substring(0,2) -Minute $date[2].Substring(2,2) -Second $date[2].Substring(4,2) | |
$file.LastWriteTime = $date | |
} elseif ($file.Name -match '\d{14}-\S*-\w*\.dm_68'){ | |
Write-Output $file.Name | |
$date = Get-Date -Year $file.Name.Substring(0,4) -Month $file.Name.Substring(4,2) -Day $file.Name.Substring(6,2) -Hour $file.Name.Substring(8,2) -Minute $file.Name.Substring(10,2) -Second $file.Name.Substring(12,2) | |
$file.LastWriteTime = $date | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment