tel Tel: (852) 2304 8895  whatsapp Fax: (852) 2304 8802  email e-mail:  
Windows 7 file paths longer than 255 characters




If you are using the Windows operating system and your backup status isn't reaching 100%, one possible cause could be that you are backing up file paths and names that exceed a 255-260 character limit. This article provides a technical explanation for this issue and a recommended solution.




The Code42 app running on Windows (all versions, x86 and x64)


Unable to Back Up X Files issues
Symptoms of this issue include:
  • Your backup never reaches 100%
  • The Code42 app is running but certain files stay on the backup to-do list
It can be difficult to correct this issue. If you try to rename, move, or delete the file in Windows, you may receive the following messages:


Source Path Too Long Error Dialog Box


Delete Folder Error


Recommended solution


Since you are not able to move the files using Windows Explorer, you must use the subst command to shorten the file path for the file(s).


The simplest way to fix this is to:
  • Substitute the folder that has a long file path with a drive letter (thereby shortening the overall character count for the files contained in the folder)
  • Copy or move the files out of the folder into another folder that won't violate the limit
  • Delete the mapped folder
You can do this using either of the methods described bel ow.


Method 1: Use the subst command to assign a drive letter to a specific folder


You can substitute a specific folder path with a drive letter using the Windows Command Prompt and the subst command. The command follows the format:






For example, if you wanted to replace the folder path C:ExampleFilePath with the drive letter Y, you would enter:



subst Y: C:ExampleFilePath



Now the Y:drive is "mapped" directly to the folder. Since you have substituted most of the long file path with Y:, it no longer violates the character limit. You can now move the files out of this folder to a folder with a shorter file path.



After you move the files, you can delete the virtual drive by running the subst command with the /d parameter. To delete the Y: drive created in the example above, enter:



subst Y: /d


Method 2: Use visual subst to assign a drive letter to a specific folder


If you aren't comfortable using the Windows Command Prompt, there is a free utility called Visual Subst that you can use to achieve the same results. Code42 does not create or test this software. If you choose to use it, we cannot provide support.



Information about the program and an example of its usage can be found at:




Map a Drive Letter to a Folder the Easy Way in Windows
Have you ever needed to repeatedly access a folder that is nested deep inside a giant hierarchy of folders? Sure, you can always create a shortcut to that folder, but did you know you can actually assign a drive letter to a folder instead? Today we’ll show you how to do this.


This ability has existed in Windows via the subst command for quite a while, so this will also work for you XP users as well.


Map a Drive Letter the Easy Way
The easiest way to assign a drive letter to a folder is to use a simple utility called Visual Subst, which gives you a nice graphical interface to assign drive letters, but also does something that the command line version can’t… you can set your virtual drives to apply again at startup.


You can download and run the utility without needing to install it, and then simply use the Browse button to select your path, and click the green plus symbol after choosing the drive letter.




At this point you should see the drive letter show up in the list. (Note that you can delete it by highlighting and choosing the red X icon, or change the path / letter by using the Save button.




If you want to save the drives, you’ll want to select the “Apply virtual drives on Windows startup” option.


Now when you open up your Computer window, you should see the new drive show up in the list.




The contents of the new M: drive will actually be the contents of my desktop folder.



Assign Drive Letters from the Command Prompt


If you are more the keyboard ninja type, or just want to know how to use the command line version, you can use the subst command to map drive letters the same way by using the following syntax:






For example, to map the M: drive to my desktop folder I would use the following command:



subst M: c:usersgeekdesktop



If you just want to see which drive letters are assigned, you can use subst without any arguments, as shown here:




To delete a drive letter you can use the /D switch instead of a path… for instance, to delete the M: drive that I just created, I would use the following syntax:



subst M: /D



Now when you use the subst command to see the current drives, you’ll see nothing in the list.




I’ve found the subst command to be very useful, not just in shortening folder paths but also in one instance where I wanted to delete my second partition… I just reassigned the D: drive letter to point to C: and copied all the data over. That way the application shortcuts still worked without having to reinstall the application.