Remove Spaces from File Names Easily

When you download new files, especially music, the file names may contain spaces and other unneeded information that you may not need. It can be a long, tedious task to rename these files bit by bit.


Product Spotlight: Use Sorcim’s Easy Files Renamer to rename & remove spaces in filenames.

EFR follows Google Software Principles. It will not ask you to provide email address to download the software.


In this article, we’ll discuss a combination of the techniques which help to quickly remove spaces from filenames without taking up too much of your precious time.

Use a Batch Script File

A Batch script file allows you to automate jobs and perform them with lightning-fast speed. The file contains instructions to perform administrative and non-administrative operations affecting Windows functionality and/ or files stored on your computer.

  1. Right-click on the desktop and point to New.
  2. Select Text Document.
  3. Copy the following commands and paste them in the Notepad file.
    Note: Replace D:\Test with the actual path of the folder that contains files for which you want to rename spaces in the file names.
    image1
  4. Click on File | Save As.
  5. Use the name of your choice in the File name field, but don’t forget to add .bat the end. So if you want to save it as Rename Files, you will type Rename Files.bat.
  6. Now move this newly created batch file inside the same folder which contains data you want to rename.
  7. Double-click the batch file to execute the script.

Important:

You may also use different arguments or switches in the firstmost command :renameNoSpace /R D:\Test

For example:

  • Using :renameNoSpace with no arguments/ switches will rename all files in the current directory where your script file is stored
  • Using :renameNoSpace /R switch will rename all files in the current folder, including all of its subfolders
  • Using :renameNoSpace SubFolder1 will batch rename files only from the sub-folder named SubFolder1 located in the current directory
  • Using :renameNoSpace D:\Test will rename files from the D:\Test directory
  • If your folder path contains spaces (for example, D:\Test Folder), you may want to use the same command with quotation marks :renameNoSpace “D:\Test Folder”
  • If you want to rename files from all the sub-folders located inside D:\TestFolder, use :renameNoSpace /R D:\TestFolder

Use Windows PowerShell

You can also use the PowerShell commands to remove spaces from filenames. Windows PowerShell is a complex command-line tool that acts as an automated task framework and a scripting language for advanced Windows users.

  1. Click on Start and type PowerShell in the Search box.
  2. Right-click Windows PowerShell, and select Run as administrator.
  3. Use the following command to set your active directory to:
    CD D:\Test
  4. Execute the following command to rename your files in bulk.
    image4

Use File Explorer

The File Explorer (previously known as Windows Explorer) does not support the automatic renaming of files. However, sorting your files in alphabetical order and using keyboard shortcuts to rename files is a very simple task. Here’s how:

  1. Open the File Explorer from the taskbar icon.
  2. Navigate to the directory that contains the files you need to rename.
  3. Click the View menu and select the List option.
  4. Right-click on an empty area of the File Explorer, point to Sort by and select Name.
  5. Your files will now be sorted in alphabetical order.
  6. Select the topmost file and press the F2 key to rename it.
  7. Now type the name of your choice and press Enter when you’re done.
  8. Press the Tab key to jump to the next file.
  9. Repeat the steps until you’ve renamed all the files.

Software Method

Another way to rename bulk quantities of files is to use the file renaming tools such as the Easy File Renamer program.

The whole renaming job of removing spaces revolves around 5 simple steps:

  1. You add the files you want to rename.
  2. You select the relevant renaming rule (Remove Text) and insert a single space in the Text field.

    Selecting the Remove Text Rule and applying the relevant settings
    Selecting the Remove Text Rule and applying the relevant settings
  3. You will now select Remove All (to indicate all spaces in the name to be removed).
  4. You click the Add Rule button.
  5. You click the Rename button in the user interface.
  6. You select Yes in the prompt.
    image3

You don’t need to be equipped with any complex technical know-how of PowerShell commands to use this software. This is a safe and easy method because entering incorrect commands in PowerShell could possibly cause a lot of harm to your computer system.