Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Last active July 20, 2020 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janikvonrotz/e3466243b04cd8573b5aa206bd220755 to your computer and use it in GitHub Desktop.
Save janikvonrotz/e3466243b04cd8573b5aa206bd220755 to your computer and use it in GitHub Desktop.
Extract and transfrom metadata of all image files in a folder#powershell
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