Search/replace file names in Powershell

Posting a command I recently found that allows you find/replace file names in Powershell on Windows. <search> and <replace> both accept a regex or you can also add the -LiteralPath option to rename-item

get-childitem *.txt | foreach { rename-item $_ $_.Name.Replace("<search>", "<replace>") }

In a world where Denvercoder69 actually does come back and reply to that blog post.

Did you find this post useful? Show some love!
DISCUSSION (1)
get-childitem * | foreach { rename-item -LiteralPath $_ $_.Name.Replace("", "") }
Classic DEV Post from Oct 19

How to be an awesome open source maintainer?

So, I open source pretty much all the personal code I write, but I've never loo...

Meghan 🌺
22. Local trans girl witch who uses a staff by night and a keyboard by day.
Join dev.to

Be a better developer. Free forever.