Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm copying 600GB of data from external hard drive A to external hard drive B.

Windows Server 2008 R2 has notified me that 100 files have filenames that are too long (i.e. >255 chars).

Is there a utility that can allow me to search for these filenames, and manually shorten them?


share|improve this question
+1, as I hate this problem and have never found a good solution – ITGuy24 Nov 2 '09 at 14:08
I hate it as well, this problem has been nagging at me for the last 2 years. – Contango Nov 2 '09 at 15:07
... and I just found the perfect solution. Horray! – Contango Nov 2 '09 at 15:10

I'm guessing that you are placing the files on drive B in a subfolder with a long name. The total length of the filename and path cannot exceed 255 characters. It may be that the DESTINATION file is too long.

share|improve this answer
Exactly. We want to reduce all SOURCE filepath lengths to less than 200 characters, to avoid problems with the DESTINATION file path being too long. – Contango Nov 2 '09 at 15:04
up vote 1 down vote accepted

Got it! Using FileLocator Pro and scripting it's fairly simple:

  1. Put the attached script somewhere on your hard drive.
  2. Open FileLocator Pro
  3. Go to the scripting tab
  4. Activate the 'Filename' script and select the path to the script
  5. Put the value 240 in the 'Custom' field
  6. Make sure the engine field is set to "JScript"
  7. Click Search
  8. The result box will list all files where the pathname > 240 chars in length.

If you want to search for files "less than" simply change the script.

For each result, right click on the file and select "Explore Here". Rename the directory path to shorten it, then repeat the search until there are no results at all.

-----start file named "max path length search.js"----

// Example of a script to identify files from the length of the full pathname
var nMaxLen = parseInt( SearchParms.FilenameCustomParm);
function isValidFileName( strPath, strFileName )
       var bIsValid = true;
               bIsValid = (strPath + strFileName).length > nMaxLen;
       } catch( e ) {}
       return bIsValid;

-----end file named "max path length search.js"----

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.