All sorts of things mess around with file dates and of concern to me was a number of home videos I transcoded that ended up with new file creation dates that I wanted to retain against the original write time.  We can handle this in Windows with a little PowerShell.  I’ll assume here that all files are in the same path and without their extensions, all files have unique names.

First capture the original creation dates:

dir | Export-CSV originaldates.csv

After your file edits are complete you use the following script (note there is line in there that will swap the extension):

Import-Csv originaldates.csv | `
    ForEach-Object {
        $originalFile = $_.Name
        $newFile = $originalFile.Split(“.”)[0] + “.mp4”
        $oldDate = get-date -date $_.LastWriteTime
        Get-ItemProperty -Path $newFile | ForEach-Object { $_.LastWriteTime = $oldDate }

This post is mostly a reminder for me but might help you out too.  Always backup before changing files and be careful!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.