Skip to content

Instantly share code, notes, and snippets.

@ngollan
Last active May 25, 2020 18:10
Show Gist options
  • Save ngollan/0c494ff7f4a035d8ee9d7cc0d1d01423 to your computer and use it in GitHub Desktop.
Save ngollan/0c494ff7f4a035d8ee9d7cc0d1d01423 to your computer and use it in GitHub Desktop.
Rename FFXIV screenshots with ISO 8601 dates
Get-ChildItem "$([Environment]::GetFolderPath("MyDocuments"))\My Games\FINAL FANTASY XIV - A Realm Reborn\screenshots" -Filter "ffxiv_*.png" |
Foreach-Object {
$_.BaseName -match "ffxiv_(?<day>\d\d)(?<month>\d\d)(?<year>\d\d\d\d)_(?<hour>\d\d)(?<minute>\d\d)(?<second>\d\d)(?<suffix>_[^\.]*)?"
$m = $Matches
Rename-Item -Path $_.FullName -NewName "$($m.year)-$($m.month)-$($m.day) $($m.hour)_$($m.minute)_$($m.second) screenshot$($m.suffix).png"
}
@mathieuhasum
Copy link

Thanks, this is exactly what I was looking for to organize my screenshots.
Some of my screenshots didn't have a "suffix", causing the regex to not match (and try to overwrite the file name with the previous matched parameters). I made the last part optional and it worked well.

Get-ChildItem "$([Environment]::GetFolderPath("MyDocuments"))\My Games\FINAL FANTASY XIV - A Realm Reborn\screenshots" -Filter "ffxiv_*.png" |
Foreach-Object {
  $_.BaseName -match "ffxiv_(?<day>\d\d)(?<month>\d\d)(?<year>\d\d\d\d)_(?<hour>\d\d)(?<minute>\d\d)(?<second>\d\d)(?<suffix>_[^\.]*)?"
  $m = $Matches
  Rename-Item -Path $_.FullName -NewName "$($m.year)-$($m.month)-$($m.day) $($m.hour)_$($m.minute)_$($m.second) screenshot$($m.suffix).png"
}

@ngollan
Copy link
Author

ngollan commented May 24, 2020

Some of my screenshots didn't have a "suffix", causing the regex to not match (and try to overwrite the file name with the previous matched parameters). I made the last part optional and it worked well.

It looks like the suffix is supposed to be milliseconds and should be part of the timestamp. I haven't observed instances of it missing, maybe it happens if you manage to take a capture bang-on the second. I'll incorporate your change :-)

@mathieuhasum
Copy link

Now that my screenshots are properly sorted, it seems that the screenshots from 2015 to 2018 didn't have the "suffix". My screenshots from Jan 2019 have them! Not sure if the change was made in the game client, or something related to a change in my computer/OS.

@ngollan
Copy link
Author

ngollan commented May 25, 2020

Square may have added it for people who used PrintScreen for active time events :-D Thanks a lot for the heads up, I only started playing early last year, so I wouldn't have seen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment