ReNamer:Long paths

From den4b Wiki
Jump to navigation Jump to search
Arrow Return.png ReNamer  

Introduction

The maximum length of paths and file/folder names is limited in every mainstream operating system and file system. The exact limits can vary significantly between systems.

For example, in Windows 10 and earlier versions the maximum path length is limited to 260 characters (MAX_PATH constant). In contrast, Linux imposes a limit of 4096 bytes for full paths and 255 bytes for file names. Older systems imposed even stricter limits, like DOS with 80 characters limit for full paths and only 12 characters (8.3 format) for file names.

Fortunately, this issue is slowly but surely getting addressed, in one way or another. We will also discuss ways of working around some of these limitations.

Long paths in Windows

Modern versions of Windows operating system have an alternative file path specification mechanism which overcomes the 260 characters limitation.

Let's take a conventional file path:

C:\Very\Long\Path

To convert a path to "long path" specification, we just need to prepend it with \\?\, as follows:

\\?\C:\Very\Long\Path

This effectively raises the maximum length of file paths to 32,767 characters.

However, there are other potential culprits:

  • This only raises a limitation imposed by the Windows operating system, while other limitations imposed by file systems may still apply.
  • The support for long paths also depends on capabilities of individual applications.

Long paths in ReNamer

ReNamer normally operates with conventional file paths, but it can also handle the "long path" specification if such was provided.

The standard Add Files and Add Folders dialogs cannot handle long paths yet. However, you can use the Add Paths dialog from the main menu or Export/Import menu options.

Truncating long paths

The limitation of the maximum file path can make files inaccessible by some applications, including even the Windows File Explorer.

A common workaround is to truncate long paths. The truncation can be performed with the help of Pascal Script and Regular Expressions rules.

References