Posted By

danfsmith on 07/19/11


Tagged

write-file


Versions (?)

Generating Gallery XML File from Images


 / Published in: Windows PowerShell
 

  1. param ($path, $urlpath)
  2. $files = Get-ChildItem -path $path -filter *.jpg | Select-Object Name
  3. Write-Output "<?xml version=""1.0"" encoding=""utf-8"" standalone=""yes""?>"
  4. Write-Output "<images>"
  5. foreach ($file in $files)
  6. {
  7. $n = $file.Name
  8. "<pic><image>$urlpath/$n</image><thumbnail>$urlpath/thumbs/$n</thumbnail><caption>$n</caption></pic>"
  9. }
  10. Write-Output "</images>"

Report this snippet  

You need to login to post a comment.