Forum Discussion

Shree2280's avatar
Shree2280
Brass Contributor
Mar 09, 2021

find and replace from folders, subfolders

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

 

Regards

Shree

1 Reply

  • farismalaeb's avatar
    farismalaeb
    Iron Contributor
    add the -Recurse parameter for the Get-ChildItem

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

Resources