Last active
July 20, 2020 18:36
-
-
Save janikvonrotz/e3466243b04cd8573b5aa206bd220755 to your computer and use it in GitHub Desktop.
Extract and transfrom metadata of all image files in a folder#powershell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-FileMetaData { | |
Param([string[]]$folder) | |
foreach($sFolder in $folder) | |
{ | |
$a = 0 | |
$objShell = New-Object -ComObject Shell.Application | |
$objFolder = $objShell.namespace($sFolder) | |
foreach ($File in $objFolder.items()) | |
{ | |
$FileMetaData = New-Object PSOBJECT | |
for ($a ; $a -le 266; $a++) | |
{ | |
if($objFolder.getDetailsOf($File, $a)) | |
{ | |
$hash += @{$($objFolder.getDetailsOf($objFolder.items, $a)) = | |
$($objFolder.getDetailsOf($File, $a)) } | |
$FileMetaData | Add-Member $hash | |
$hash.clear() | |
} #end if | |
} #end for | |
$a=0 | |
$FileMetaData | |
} #end foreach $file | |
} #end foreach $sfolder | |
} #end Get-FileMetaData | |
$currentFolder = Get-Location | |
$metadata = Get-FileMetaData $currentFolder | |
$metadata | ForEach-Object { | |
"{{< figure src=`"/images/$(Split-Path $currentFolder -Leaf)/$($_.Filename)`" title=`"$($_.Title)`" >}}`n" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment