Windows: Batch replace character in filenames

Posted: November 27, 2014 in Windows
Tags:

Continuing my last post, batch rename files to lowercase

I need replace some characters in the filenames.

1. Open Powershell

2. Change directory to where those files are stored.

3. Type the following command. The below command is to replace all dash(-) to underscore(_)

Dir | Rename-Item –NewName { $_.name –replace “-“,”_” }

All credits go to http://stackoverflow.com/questions/16636996/replace-or-delete-certain-characters-from-filenames-of-all-files-in-a-folder

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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