Skip to content

Instantly share code, notes, and snippets.

@soyfrien
Created June 13, 2017 18:33
Show Gist options
  • Save soyfrien/a86b00f0dad22974d118b6951730ca58 to your computer and use it in GitHub Desktop.
Save soyfrien/a86b00f0dad22974d118b6951730ca58 to your computer and use it in GitHub Desktop.
rename integer named folders to maestro[n]
$topcon_controlsPath = "FULL_PATH"
$i = 1;
$dirs = Get-ChildItem -Directory $topcon_controlsPath | Select-Object -ExpandProperty Name | ForEach-Object { [Int]$_ } | Sort-Object
foreach ($d in $dirs)
{
$currentPathName = $topcon_controlsPath + "\" + $d
$newPathName = $topcon_controlsPath + "\Maestro" + $i
#Read-Host -Prompt "Press Enter to rename $currentPathName to $newPathName"
#Rename-Item -Path $currentPathName -NewName $newPathName
Write-Host "Renamed $currentPathName to $newPathName"
$i++
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment