Search/replace file names in Powershell

Meghan (she/her) - Jul 10 '18 - - Dev Community

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>") }
Enter fullscreen mode Exit fullscreen mode

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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player