Skip to content

Instantly share code, notes, and snippets.

@dcabines
Created August 23, 2022 20:10
Show Gist options
  • Save dcabines/51ecb7c4cd70f5d18387f877c643f162 to your computer and use it in GitHub Desktop.
Save dcabines/51ecb7c4cd70f5d18387f877c643f162 to your computer and use it in GitHub Desktop.
$originalsFolder = 'originals'
$resizedFolder = 'resized'
$reorganizedFolder = 'reorganized'
$originals = Get-ChildItem -Path $originalsFolder -Recurse -Include *.jpg
foreach ($original in $originals) {
$resized = Get-ChildItem -Path $resizedFolder -Recurse -Include $original.Name
$destination = ($resized.FullName).Replace($resizedFolder, $reorganizedFolder).Replace($resized.Name, "")
New-Item $destination -Type Directory
Copy-Item $original -Destination $destination
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment