Issue #7822 has been updated by Eric Loveland.


The linked article mentions that each component (individual folder in the path) can have a maximum of 255 characters.

The following works:

~~~
Dir.mkdir "\\\\?\\C:\\#{'t'*255}"
Dir.mkdir "\\\\?\\C:\\#{'t'*255}\\#{'t'*255}"
~~~

However, there is a general Ruby file issue related to this: Windows does not allow forward slashes for Win32 File Namespaces (\\\\?\\ paths).  Thus these paths cannot be used with any methods that use File::SEPARATOR, such as File.join since File::SEPARATOR is '/' on Windows.

----------------------------------------
Bug #7822: Dir.mkdir can't handle long Windows Unicode paths (\\?\UNC\)
https://bugs.ruby-lang.org/issues/7822#change-46224

* Author: Patrick Pokatilo
* Status: Assigned
* Priority: Normal
* Assignee: Usaku NAKAMURA
* Category: 
* Target version: 
* ruby -v: ruby 1.9.3p362 (2012-12-25) [i386-mingw32]
* Backport: 
----------------------------------------
Code:
  Dir.mkdir "//?/C:/" + "test" * 100

What I expected:
  Ruby will create directory //?/C:/testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest, judging from http://msdn.microsoft.com/en-us/library/aa365247.aspx

What happened on the second call:
  Errno::ENOENT: No such file or directory - //?/C:/testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
          from (irb):6:in `mkdir'



-- 
https://bugs.ruby-lang.org/