Skip to content

Instantly share code, notes, and snippets.

@kzndotsh
Created May 24, 2022 18:47
Show Gist options
  • Save kzndotsh/dc9e4f963588e49c890e3bd6f83f7f59 to your computer and use it in GitHub Desktop.
Save kzndotsh/dc9e4f963588e49c890e3bd6f83f7f59 to your computer and use it in GitHub Desktop.
moveFilteredFilesToFolders.ps1
$items = gci .\ -Recurse -File -Include *480p*, *720p*, *1080p*
foreach($item in $items) {
if($item.Name -like "*480p*") {
Move-Item -LiteralPath $item 'G:\path\480p'
} elseif($item.Name -like "*720p*") {
Move-Item -LiteralPath $item 'G:\path\720p'
} elseif ($item.Name -like "*1080p*") {
Move-Item -LiteralPath $item 'G:\path\1080p'
} else {
Write-Host "The path did not match what was expected"
Write-Host $item.Name
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment