Replace Spaces in File Names with Underscores

In today’s world, we need to get things done really fast. Naming a few files is a simple and straightforward procedure. But the problem arises when you have hundreds of thousands of files scattered across different folders, subfolders of your hard disk. There is no native tool in Windows to batch rename files. Renaming files manually could take a lot of time and effort. In this tutorial, we’ll discuss some of the easiest ways to batch rename your files and replace spaces with underscores.

Replace Spaces with Underscores or Other Characters in the Filenames

Use Easy File Renamer (EFR) software to rename all your files easily. EFR is a secure and private computer program which follows industry standards ensuring users privacy. You will not be asked to enter your email address to download this program. And, you will not be forced to install third-party addons with the application. You will remain in 100% control of the operations of the computer. The EFR will never take an action on your computer without your consent. It will show you the preview of the renaming before actually applying the renaming rules on your files. You can download it risk-free. 


 

Why Would You Need to Batch Rename your Files?

Different circumstances cause disorganization of your file library and incorrect file naming. Here are some of them:

File Syncing & Sharing

If you’re regularly sharing and syncing files, you’ll accumulate too many files with improper file names. Over time, your hard disk will become disorganized with a lot of such files and you will lose track of any important documents.

File Copying Errors

While copying files to another directory, Windows may display a warning that a file already exists with the same name in the destination directory. If you choose to copy it anyway, Windows will add a suffix to the original file name (such as, -Copy(2), -Copy(3), etc).

Replace Spaces with Underscores

Method 1: Using Windows Explorer

You can use Windows Explorer to batch rename files without downloading any third-party tool. Here’s how:

Double-click This PC.
Go to the folder that contains your files.
Click on the View tab on the Ribbon interface.
Set the Layout to Details.
Choose the first file to rename, press, and continue holding the Shift key.
Now, select the last file to rename to automatically select all the files in a pattern of your choice.
Press the F2 key and type a new name for your files.
Press Enter to execute it.

Method 2: Using Windows PowerShell

PowerShell is a complex, command-line tool, much similar to Command Prompt. Use it with caution. Executing incorrect commands could cause unexpected data loss.

Click on Start.
Type PowerShell.
Right-click on Windows PowerShell and select Run as Administrator.
Enter the path to your directory. For example:
CD C:\Users\Vikas\Documents
To replace spaces in filenames with underscores for all files, irrespective of their types, use the following command:
get-childitem *.* | foreach { rename-item $_ $_.Name.Replace(” “, “_”) }
To replace only specific file types (for example, .docx), use the following command:
get-childitem *.docx | foreach { rename-item $_ $_.Name.Replace(” “, “_”) }
Exit after completion.

Method 3: Using a VBScript

You can similarly create a Visual Basic Script (VBScript) to avoid the pain of typing your commands each time you want to rename your files.

1. Open Notepad.
2. Type the following text:

Command

3. Click on File, select Save As.
4. Type a name: BatchRename.VBS
5. Exit Notepad, and double-click the newly created file.

Method 4: Using Easy File Renamer

The safest and quickest way to rename your files and replace spaces in filenames with underscores is to use Easy File Renamer. EFR lets you add multiple folders at a time, to batch rename files from different folders. It saves a lot of your time.

Features

Rename hundreds of files at once
Multiple renaming patterns to choose from
Securely rename files without data corruption
You get a FREE complimentary license to Sorcim’s Cloud File Renamer. Using CFR, you can rename files on the Cloud (Dropbox, OneDrive, Dropbox, Amazon S3, etc) without downloading them yourself.
Easy File Renamer comes with other add-on features to batch transfer files without errors. You can copy/ move large files quickly and safely. EFR also includes an MP3 tag editor that lets you batch edit music tags, without needing to purchase another application.

Renaming Patterns:

Add Prefix: Add a text before the start of the file name.
Add Suffix: Add a text after the file name, before the extension.
Remove Text: Remove a specific part of the file names and shorten the actual file name.
Replace Text: Use this renaming rule to replace spaces with underscores, and vice versa.
Insert At: Insert a character at a specific interval.
Change Case: Change the case of your text, from UPPERCASe to lowercase, and vice versa.
Numbering: Add numbering to your files, if you’ve multiple files with the same name.

Steps

Download and install Easy File Renamer.
Click on Files > Add Files.
Select the files you want to rename. You can select multiple files at once.
In the Select Rule, choose Replace.
Type space in the Find box.
Type an underscore (_) in the Replace box.
Make sure to select the Replace All option.
Click on Add Rule.
You can add other rules if required.
Click on Rename to proceed.




Leave a Reply

Your email address will not be published.


Comment


Name

Email

Url