Skip to main content

Cornell University

Windows: The File Name or Destination Path You Specified is Not Valid or Too Long

This article applies to: Shared File Services

If your application or end-users require long file names or long path names, we strongly recommend that you include the replication option when you request or update your share(s). We have found that file names or path names beyond the 255 character limit are often impossible to restore from the DR copy.

Microsoft Windows has a MAX_PATH limit of ~256 characters. If the length of the path and filename combined exceed ~256 characters you will be able to see the path/files via Windows/File Explorer, but may not be able to delete/move/rename these paths/files.  

Some Windows utilities including most versions of File Explorer will prepend the file path with “\\?” to show that the path is beyond the character limit. This display is called an extended-length path prefix.

Applications which utilize UNC paths (such as robocopy) and Macintosh (MacOS) systems accessing CIFS do not have the MAX_PATH limitation and can cause this condition.  

A CIFS share containing a file structure which exceeds MAX_PATH may sometimes be remediated in the following 3 ways:

  1. Rename or move a deep folder. If possible rename or move the folder(s) so that the target files that are deeper than the MAX_PATH no longer exist. If you do this, start at the root folder (or any other convenient place), and then rename or move folders/files so that they have shorter names. 
  2. Utilize UNC pathing in Windows Explorer.
    Note: This allows you to browse down the sub-folders to a path length of ~512 characters below the Network Mapped Drive. If your path length is still excessive, start this process by establishing a Network Mapped Drive at a deeper level, closer to the 256 character MAX_PATH as the starting point.
    • Open Windows/File Explorer.
    • Select the existing Network Mapped Drive to your share.
    • Using the Network Mapped Drive letter, access the UNC path.
      Enter \\?\’drive-letter’\ and then press Enter.
    • Access and correct the file system as necessary.
  3. Attempt remediation utilizing a Macintosh (MacOS) system. Since Macintosh systems aren’t limited by the Microsoft MAX_PATH limit you may be able to browse/rename the path/files as required from a MacOS system.
  4. If none of these options work for you, use the form to contact Shared File Services for guidance.

Note: The MAX_PATH limit also impacts restoration of deleted files from snapshots.  If file restoration from snapshots is necessary on files which exceed MAX_PATH, it may be possible via the above methods.

Comments?

To share feedback about this page or request support, log in with your NetID

At Cornell we value your privacy. To view
our university's privacy practices, including
information use and third parties, visit University Privacy.