Skip to content

Instantly share code, notes, and snippets.

View smphillips's full-sized avatar

Shane Phillips smphillips

View GitHub Profile
@smphillips
smphillips / url-replace.ps1
Created August 6, 2018 00:50
Powershell to replace URLs in text files
Clear-Host
# TODO: Load this hash table from your CSV source (using Import-Csv)
[hashtable] $urls = New-Object hashtable
$urls.Add("https://www.old.com/1", "https://www.new.com/1")
$urls.Add("https://www.old.com/2", "https://www.new.com/2")
# TODO: Change the -Path value here to the desired path
Get-ChildItem -Path "." -Filter "*.txt" | ForEach-Object {