File path too long reading recursive files and folders

David Bird
David Bird used Ask the Experts™
I have inherited a windows 2003 SBS server network where over the years literally millions of files have accumulated. Moving/archiving them to the new server fails because many files are over 300 characters in the path and file name.  I am unable to run my code against the folder tree as it fails when it hits one of these files.  I don't want to trap the error and skip it. It's those files specifically I'm looking for.  While secondary but not entirely rhetorical, to me it begs the question, how were the files ever written in the first place?
I would appreciate any help on how to, via if possible, read the folder tree and store it in a data table so that we can access and rename these files to a reasonable length and move them off of the server.

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Probably by desktop shortcuts to the middle of the path.  255 is the limit but users find a way around that and is a constant pain to Network Admins.
Found the .net for frameworks 4 replacement Library to handle long paths and characters.
David BirdOwner


No one responded and as I continued my quest, I found Delimon's IO replacement

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial