Blogs

Identifying folders longer than MAX_PATH on file servers

  • Comments 1
  • Likes

A reader sent us a question asking if there is a scriptable way to identify folders whose paths (including the folder name) exceed 260 characters on file servers. As the reader points out, our File Server Migration Toolkit will identify these long paths during migration, but he’d like a way to script this detection without using FSMT. We asked one of our scripting experts, Maxim Stepin, to respond:

This is sort of trivial to write in C++, just convert names to \\?\c:\path format and do FindFirst/FindNext directory traversal.

Looking to purely scriptable solution I would suggest to use robocopy.exe in list only mode (/L). It will list all the files including their full path in the given directory including long path ones. I just tried : "robocopy /l /e /fp /ndl c:\LongPath c:\temp > list.txt" and it works. Resulted output can be easily parsed by any scripting language then.

--Max

 

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment