How to Fix Long File Path Errors in Windows and Rename Files

The maximum supported file path length in Windows is 260 characters. Windows may display an error when you exceed this limit. As a result, you may not be able to move, rename or even open such a file.

Rename multiple files in folders and subfolders. Utilize 10+ renaming rules. Also rename files on the Cloud. Use Easy File Renamer today! 

Causes

Setup programs and file compression programs are often a culprit. Sometimes, installation programs extract files to temporary directories and leave a large length of long file names.

Other times, simple file copying/ moving operations cause this problem. If you’re storing your data into long directories (for example, D:\RootFolder\SubFolder1\SubFolder2\SubFolder3), don’t be surprised if you come across this problem.

Solutions

 

  • Using Windows PowerShell

 

Method 1: Remove Long Words from File Names

PowerShell is a command-line utility, much like Command Prompt. You can use PowerShell to run for automation and to perform various administrative tasks.

For example, if you’ve a school album with hundreds of photos starting with a common word “schoolmemories_” (such as, schoolmemories_001.jpg, schoolmemories_002.jpg, schoolmemories_003.jpg, ….), you can use the command given below which will strip off the word “schoolmemories_” from the file names, and make them short and simple.

Output:

001.jpg

002.jpg

003.jpg

Renaming files using PowerShell-

  1. Type PowerShell in the Search Box on your Taskbar.
  2. Right-click Windows PowerShell in the Search Results and select Run as Administrator.
  3. In the newly opened window, type “CD” followed by the path to your folder. For example, “CD D:\SomeFolder”.
  4. Now, execute the following command to start renaming:

get-childitem *.* | foreach { rename-item $_ $_.Name.Replace(“schoolmemories_”, “”) }

Method 2: Strip Off Specific Number of Characters from the Beginning of the File Name

Another simple method is to remove a specific number of characters from the beginning of long file names. This is an ideal option if file names are not unique in nature, and they have different text patterns.

Open PowerShell.

Type “CD” followed by the target directory. For example: “CD D:\SomeFolder”

Now, execute this command:

get-childitem * | rename-item -newname { string.substring(16) }

The above command will strip off the first 16 characters from each file name. If your original file names are schoolmemories_001.jpg, schoolmemories_002.jpg, schoolmemories_003.jpg, …, the output file names will be 001.jpg, 002.jpg, 003.jpg, etc.

To limit the above command to only specific extensions (for example, only PDF documents), you can make some minor changes to it (as shown below)-

get-childitem *.pdf | rename-item -newname { string.substring(16) }

You may replace .pdf with any other file type of your choice.

  1. Using Easy File Renamer (Recommended)

Easy File Renamer, as the name describes, is a file renaming tool from industry-leading Sorcim Technologies. 

Easy File Renamer has a user-friendly interface that makes it easy and fun to batch rename files without much effort. Additionally, there is no possibility of accidental data deletion, which is a critical concern in the case of command-line tools. For example, mistyped commands in PowerShell can do more harm than good. Within a few seconds, you could lose important data on your hard disk, or make it inaccessible and irrecoverable.

With Easy File Renamer, the steps are fairly simple and straightforward:

  • Add your files (You may want to click on the Add Files option and select your files. Don’t worry, you can select multiple files at once. You DO NOT need to add one file at a time).
  • Select your desired renaming rule. A renaming rule is a criteria for renaming your files. For the purpose of this article, select Remove Text and specify the characters you want to strip off from the file names. For example, 5, 10, or 16.
  • Once you’ve selected your rule, just click on Rename.

That’s it, it’s that simple! No complex commands, no complex interface. With a few clicks, you can batch rename hundreds of files safely and securely.