Added .mp4

This commit is contained in:
Chris Stuurman 2025-01-06 23:32:41 +02:00
parent 6e9fc6e849
commit 6729c67853
2 changed files with 13 additions and 19 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
log4.txt

View File

@ -34,12 +34,16 @@ $Main =
$medialist=[System.Collections.Generic.List[object]]::new()
$Files_jpg = Get-ChildItem -Path $SourceFolder -File -Filter "*.jpg" -Recurse
$Files_raw = Get-ChildItem -Path $SourceFolder -File -Filter "*.cr?" -Recurse
$Files_mp4 = Get-ChildItem -Path $SourceFolder -File -Filter "*.mp4" -Recurse
ForEach ($File in $Files_jpg) {
$medialist.Add($File)
}
ForEach ($File in $Files_raw) {
$medialist.Add($File)
}
ForEach ($File in $Files_mp4) {
$medialist.Add($File)
}
foreach ($mediafile in $medialist) {
$xfoutput = @(C:\Tools\exiftool\exiftool.exe $mediafile.FullName)
$sourcefilefullname = $mediafile.FullName
@ -51,13 +55,13 @@ $Main =
$value=$arr[1].Trim()
$exiflist[$key] = $value
}
# Write-Output $exiflist
$CreateDate = cv2datetime $exiflist['CreateDate']
$Date_TimeOriginal = cv2datetime $exiflist['Date_TimeOriginal']
$FileCreationDate_Time = cv2datetime $exiflist['FileCreationDate_Time']
$FileModificationDate_Time = cv2datetime $exiflist['FileModificationDate_Time']
$FileAccessDate_Time = cv2datetime $exiflist['FileAccessDate_Time']
$skip = $false
# $time_arr = ""
if ($null -eq $CreateDate) {
if ($null -eq $Date_TimeOriginal) {
$filenamedate = validatedate $mediafile.Name
@ -74,26 +78,10 @@ $Main =
}
else {
$datestr = $Date_TimeOriginal.ToString('yyyyMMdd')
# $time_arr = @($Date_TimeOriginal -split " ", 2)
# $datestr = $time_arr[0] -replace ":"
# if (($null -eq $datestr) -or ($datestr -eq "")) {
# Write-Output "Skipped ""$sourcefilefullname"" : File has no usable ExifData!" | Tee-Object -FilePath $LogPath -Append | Write-Host -ForegroundColor DarkRed
# $skip = $true
# }
}
}
else {
$datestr = $CreateDate.ToString('yyyyMMdd')
# $time_arr = @($CreateDate -split " ", 2)
# $datestr = $time_arr[0] -replace ":"
# if (($null -eq $datestr) -or ($datestr -eq "")) {
# $time_arr = @($Date_TimeOriginal -split " ", 2)
# $datestr = $time_arr[0] -replace ":"
# if (($null -eq $datestr) -or ($datestr -eq "")) {
# Write-Output "Skipped ""$sourcefilefullname"" : File has no usable ExifData!" | Tee-Object -FilePath $LogPath -Append | Write-Host -ForegroundColor DarkRed
# $skip = $true
# }
# }
}
$sourcefiledir = "$($mediafile.Directory)"
#Write-Output $time_arr
@ -118,7 +106,7 @@ Function validatedate {
}
$datestart = 0
$stryear = $datetimestr.substring($datestart,4)
if ($stryear -eq "IMG-") {
if (($stryear -eq "IMG-") -or ($stryear -eq "VID-")){
$datestart = 4
$stryear = $datetimestr.substring($datestart,4)
if ($datetimestr.Length -le 17) {
@ -223,7 +211,12 @@ Function cv2datetime {
if ($result -eq "") {
return $null
}
return [DateTime]$result
try {
return [DateTime]$result
}
catch {
return $null
}
}
Function cleanfolder {
[CmdletBinding()]