Skip to content

Instantly share code, notes, and snippets.

@froschgrosch
Created August 17, 2023 20:34
Show Gist options
  • Save froschgrosch/4558a2ada182c9e79e6e19ee0bc6aa03 to your computer and use it in GitHub Desktop.
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
# 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