-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchange_filetime.ps1
30 lines (17 loc) · 932 Bytes
/
change_filetime.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<#
Use> ps change_filetimes.ps1 "FilePath" <"TimeString">
Used to change the times that are set on a Image or Video file. If a time is not provided on the command line use the last write time from the file
This was created so that all our family movies can be viewed and played in Amazon Photos
Requires: Exiftool to encode metadata to new file
#>
param([string]$fileName, [string]$time)
if (-not($fileName)) {
Throw "You must supply a value for the file"
}
# if you don't set the time get it from the file
if (-not($time)) {
$time = (Get-Item $fileName).LastWriteTime.ToString("yyyy:MM:dd HH:mm:ss");
}
write-output "$fileName"
write-output "$time"
&"C:\ProgramData\chocolatey\bin\exiftool.exe" -overwrite_original -FileCreateDate="$time" -FileModifyDate="$time" -quicktime:CreateDate="$time" -quicktime:ModifyDate="$time" -quicktime:mediacreatedate="$time" -quicktime:mediamodifydate="$time" "$fileName"