Extract and transfrom metadata of all image files in a folder#powershell
This file contains 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