Two problems – one answer. Very long file and folder names causing problems ?

Investigating a problem for a client led to a review of file and folder names as the client was hitting issues where the combined file and folder name length was in the region of 250 chars or more. This specifically led to issues when folders were being cut and pasted from one directory tree to another and the total length exceeded windows in built limits of 260 characters.

The second problem related to a client wishing to move a range of files into sharepoint and were having issues with both url lengths and characters in the file or directory names.

So when researching both of these came up with the same solution to both.

This utility Shareprep is actually meant for dealing with the second problem

SharePrep is a special-purpose utility program for SharePoint that you can use to correct file and folder names in preparation for importing data into Microsoft’s SharePoint Server and MOSS. The folder and filenames within SharePoint have more restrictions than for normal Windows operation.   These restrictions are for both special characters and length of the file names and folder names.

However I found that I could also use it to scan the files and folders relating to the first problem and tell the client which folders needed attention and how to be prepared for the errors such as

The file or folder name <name> contains invalid characters. Please use a different name. Invalid characters include the following:

~ ” # % & * : < > ? / { | }.

The name cannot begin or end with a dot and cannot contain consecutive dots.


The specified file or folder name is too long. The URL path for all files and folders must be 260 characters or less (and no more than 128 characters for any single file or folder name in the URL). Please type a shorter file or folder name.