Below is the script you can use as a windows powershell script to rename bulk folders in single command . ..
$path = "your path to the folder in which folders list is to be renamed"
# Validate the path
if (-Not (Test-Path $path)) {
Write-Host "Invalid path! Please check and try again."
exit
}
# Read folder names (original and new) from text files
$oldNames = Get-Content "$path\folder_list.txt"
$newNames = Get-Content "$path\to_rename.txt"
# Ensure both files have the same number of entries
if ($oldNames.Count -ne $newNames.Count) {
Write-Host "Error: The number of old and new folder names does not match!"
exit
}
# Rename folders
for ($i = 0; $i -lt $oldNames.Count; $i++) {
$oldFolder = "$path\$($oldNames[$i])"
$newFolder = "$path\$($newNames[$i])"
if (Test-Path $oldFolder) {
Rename-Item -Path $oldFolder -NewName $newNames[$i] -Force
Write-Host "Renamed: $oldNames[$i] -> $newNames[$i]"
} else {
Write-Host "Folder not found: $oldNames[$i]"
}
}
Write-Host "All folders processed."