Can someone help me get this line right?
powershell Set-ItemProperty -LiteralPath '[NewVideo]' -Name CreationTimeUtc -Value ('[CreationTimeOfOldVideo]' -as [Datetime])
I am trying to rotate video files 90 degrees, while preserving the creation date of the original file. I have found the way to do the rotation using ffmpeg, but am stuck trying to copy the creation date to the new file. A search made me conclude that it should be possible with powershell (of which I know hardly anything)
This is what I have so far:
FOR /r %%I in (*.avi, *.mp4) DO CALL :loopbody "%%~fI" "%%~dpnI_%%~xI" "%%~tI" GOTO :EOF :loopbody ffmpeg -i %1 -c:v libx264 -crf 18 -maxrate 4000k -bufsize 4000k -c:a libvo_aacenc -q:a 100 -map_metadata 0 -preset veryslow -tune film -movflags +faststart %2 powershell Set-ItemProperty -LiteralPath '%2' -Name CreationTimeUtc -Value ('%3' -as [Datetime])
Which was thankfully copied from another user at this forum. The problem lies in the last line. The %3 variable is the cmd date ($~tI) of the old file, which usually is the LastModifiedDate, not the CreationDate. I need powershell to set the creationdate of the new file the same as the creationdate of the old file. I have done some experimenting with [oldfile].CreationTimeUTC, to no avail.
Help is much appreciated.