Skip to content

Instantly share code, notes, and snippets.

@CouldBeThis
Forked from dcabines/reorganize.ps1
Created August 24, 2022 00:46
Show Gist options
  • Save CouldBeThis/40a546783384a51ef62e7faec85b6eb2 to your computer and use it in GitHub Desktop.
Save CouldBeThis/40a546783384a51ef62e7faec85b6eb2 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