0

I have 5000 folder under a specific path as /servername/home. I want to rename them by reading the folder names from text file. I tried the below script but it does not work.

Foreach($folder in Get-Content "Z:\rename1.txt") {

Rename-Item -Path "Z:\$folder" -NewName "$folder _old" -Confirm }

  • /servername/home/sadnp3 and i have the similar folder with other user names and i want then to be renamed as /servername/home/sadnp3_old for like 5000 users – rakesh chowdary Dec 17 '19 at 20:39

1 Answers1

0

try this

Foreach($folder in Get-Content "Z:\rename1.txt") { Rename-Item -Path Z:\$folder -NewName $folder"_old" -confirm }