Search This Blog

Thursday, February 17, 2022

Powershell - Fixing my CreationTime with LastWriteTime

Techsmith's SnagIt has long been invaluable to me with all the screen captures that I do.  Up through SnagIt 2021, it has nicely organized all my screen captures by Year/Month within its Library.

Upon upgrading to SnagIt 2022, they converted over all my snag its and they mysteriously dispensed with Library's nice organization.  Now I have a jumbled mess of 6000 captures and I'm so very lost.

The mistake I made after upgrading was that I moved out all the old .SNAG files to a backup location.  The .SNAG files live here for version 2021 and prior:
C:\Users\User\AppData\Local\TechSmith\Snagit\DataStore

I uninstalled 2022, reinstalled 2021, and restored my image files back to it's appropriate DataStore folder.  However, upon copying, Windows changed the Creation Date and now my SnagIt Library thinks all the files are of today's date.  Oh boy.  What a mess!

Luckily, the modification timestamps are intact.  If I can just make the Create Time the same as the Mofication time, then my SnagIt Library would subgroup the files and I'm back to where I was. So, with one powershell command I can fix all my .SNAG files to make the Creation timestamp be the same as the LastWriteTime timestamp:

PS C:\Users\User\AppData\Local\TechSmith\Snagit\DataStore> Get-ChildItem *.SNAG | ForEach-Object{$_.CreationTime = $_.LastWriteTime}

As a side note, if you get this error, this means you need to close out of SnagIt 2021 and retry the powershell command above.

Exception setting "CreationTime": "The process cannot access the file
'C:\Users\User\AppData\Local\TechSmith\Snagit\DataStore\C72D8F24-C2EB-477C-A569-630E25980C4D.SNAG' because it is being used by another process."
At line:1 char:38
+ ... -ChildItem *.SNAG | ForEach-Object{$_.CreationTime = $_.LastWriteTime}
+                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
    + FullyQualifiedErrorId : ExceptionWhenSetting


No comments: