Identifying folders longer than MAX_PATH on file servers

Published 04-10-2019 01:08 AM 80 Views
Not applicable
First published on TECHNET on Feb 15, 2006
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.


Version history
Last update:
‎Apr 10 2019 01:08 AM
Updated by: