exiftool csv匯入資料

Step1 匯出原本資料

exiftool.exe -csv Z:\20170101 > exif.csv
保留SourceFile欄位
新增DateTimeOriginal

Step2 使用momentjs產生時間(間隔1秒)

var a = moment('2017-01-01 06:50:00');
var tmp = [];
for (var i = 0; i < 100; i++) {
    tmp.push(a.add(1, 's').format('YYYY:MM:DD HH:mm:ss+08:00'));
}

Step3 使用PowerShell批次執行exiftool

AllDates is a shortcut for 3 tag names: DateTimeOriginal, CreateDate and ModifyDate.

$csv = import-csv -LiteralPath Z:\exif.csv
$exiftool = "C:\exiftool.exe"
$files = Get-ChildItem -LiteralPath Z:\20170101 -File
foreach($row in $csv){
   &$exiftool -alldates="$($row.DateTimeOriginal)" $row.SourceFile
}
view raw Step.md hosted with ❤ by GitHub