$filePath = Read-Host "Enter file path" $Files = get-childitem $filepath -Recurse | where-object {($_.Name -like "*.csv") -or ($_.Name -like "*.config") -or ($_.Name -like "*.ps1") -or ($_.Name -like "*.xml") -or ($_.Name -like "*.txt")} foreach($file in $files) { if ($File.Attributes -ne "Directory" -and $File.Attributes -ne "Directory, Archive") { if ($File.IsReadOnly -eq $true ) { Set-ItemProperty $File.FullName -name IsReadOnly -value $false (get-content $File.FullName).replace('https://oldurl','https://newurl') | Set-Content $File.FullName } else { (get-content $File.FullName).replace('https://oldurl','https://newurl') | Set-Content $File.FullName } } #(get-content $File.FullName).replace('etest1url','eURL') | Set-Content $File.FullName }
Wednesday, May 31, 2023
Subscribe to:
Post Comments (Atom)

0 comments:
Post a Comment