Dealing with long file names

Users often like to write long essays for file names, (eg, client comparison with previous files from 1976/clientlist/this_is_a_useful_file_worth_looking at.txt

Not surprisingly, the 256 character limit often gets exceeded, and this causes two problems:

  1. It makes it difficult to move data to different drives
  2. The files won’t back up properly, but you won’t find that out until you try and restore data.

The solution is to to educate users to shorten their file names and flatten their directory structure where possible, but often you only find out about the problem too late.

This method will help you to find the files which are too long, and to rename them.

1. Open a DOS window and use cd command to browse to the directory you want to list, and then use dir /s /b  >filenames.txt to create a list of files.

2 Change the filenames.txt to filenames.csv and open the file in Excel

You can now use Excel to tell you which filenames are longer than 256 characters.  (if the directory is on a disk, subtract 3 characters because D:\ counts as three characters.

Dealing with long file names over 256 characters

Clients often make the mistake of writing essays for filenames, which makes moving files to a new server difficult.  NTFS will not support paths longer than 256 characters, including the drive letter.  One solution to this is to use Pathscan ( http://www.softpedia.com/get/System/File-Management/Path-Scan.shtml ) and issue the client with a report.  They can then rename files and folders at their leisure to get them below the 256 character file length.  Pathscan can be run on mapped drives.