4

I'm helping my uncle transferring all his photography images from a Windows machines internal and external hard drives to his newly bought NAS and we stumbled across a little problem (happening to 'only' 3.000 files..), called 'File name/folder name too long to copy'. So.. I'm looking for an application that can find all files with a certain name length for me.

Windows Explorer can search by name, type, size, etc. but as far as I can tell it cannot search by name length. Therefor I'm looking for an application that can do so.

Note: This may be a prompt command providing that the outcome can simply be exported.


Bonus! Also applicable on the command prompt: changing file/folders name from the same application! Dashes, dots and spaces are in fact unnecessary and can result in shorter names, thus perhaps possible to transfer!

2 Answers2

5

The Windows Explorer as well as .NET Framework applications have problems with paths that exceed 260 characters (see here: https://stackoverflow.com/questions/1880321/why-does-the-260-character-path-length-limit-exist-in-windows)

What you can do to circumvent this is simply shorten the path by means of mapping it to a drive letter with subst.exe like this:

subst.exe <DriveLetter>: <super long path without trailing backslash>

Example:

subst.exe A: C:\users\%username%\appdata\local\temp

This maps my super long path (C:\users\%username%\appdata\local\temp in this case) to the drive letter A: thus reducing the path length by more than 20 characters. This also works with UNC paths on your NAS.

The drive is visible in the Windows Explorer so you only have to open the commandline to map the drive. It'll automatically be unmapped when you log off/reboot the PC.

megamorf
  • 2,454
1

I'll shortcut your problem.

Your filespecs (the combination of the 8.3 filename and folder name) exceed the 255 character limit. This is likely due to deeply nested folders.

For the files that cannot be moved, move their folders to the root of the drive, and then perform the transfer operation. It should now work.