find and replace from folders, subfolders

Brass Contributor

Hi Expert,


I am trying to find and replace from folders and subfolders files etc .presently i can do it to one folder only


Get-ChildItem D:\Check\*.config  | Foreach {(Get-Content $_) -replace '22.10.','SQL1'| Set-Content $_}


how i can i do it for multiple subfolders.i.e

afolder-afolder,bfolder--cfolder so on




1 Reply
add the -Recurse parameter for the Get-ChildItem

Get-ChildItem C:\Windows\*.config -Recurse