Quick Tip: Batch SVN Rename of files through Powershell

Quick TipI’m trying to use Powershell more and more, and today I ran into a directory in one of my projects that had a lot of files that needed renaming. Here’s the trick on how to do it in Powershell.

I needed all filenames that had a space in them replaced with an underscore so that they would run properly in our batch scripts. In addition, I needed to do this through SVN, and not just a standard rename, so that our other developers noted the changes as well.

After a little tweaking, here’s the quick and easy way to do it through Powershell.

Note that I’ve formatted this on multiple lines for readability, simply remove the newline characters so that it is a single line and you can run it at the command prompt in the directory of your choosing.

If you need to tweak things a little, make sure to change the -match parameter on the first line to the character (and potentially string) that you’re filtering off of, as well as the replace statement.




1 thought on “Quick Tip: Batch SVN Rename of files through Powershell”

What are your 10 bits on the matter? I want to know!

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s