windows and file names > 256 bytes

Albert-Jan Roskam sjeik_appie at hotmail.com
Fri Jun 26 13:58:57 EDT 2015


<snip> 

> import os import shutil import sys
>  
> # create an insanely long directory tree p = os.getenv("TEMP")
> #p = ur"\\server\share\blah\temp"
> tmpdir = p os.chdir(tmpdir)
> for i in xrange(1000):
>     tmpdir = os.path.join(tmpdir, "sub") os.mkdir("\\\\?\\" + tmpdir)
>     #os.mkdir(u"\\\\?\\UNC" + tmpdir[1:])
>  
> # write a file to it deep = "\\\\?\\" + os.path.join(tmpdir, "deep.txt")
> assert os.path.exists(deep)

sorry, this "assert" should of course follow 'with open(..' 

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus





More information about the Python-list mailing list