Python long filename support on Windows

I am writing a Python script to copy files; unfortunately, it continues to fail because the file name is too long (> 256). Is there any way to solve this problem?

I am using Python 2.5.4 and Windows XP.

Greetings

+4
python windows
source share
3 answers
+9
source share

To use the \\?\ Prefix (as already suggested), you also need to make sure that you use Unicode strings as file names, not regular (byte) strings.

+8
source share

Have you tried the workarounds suggested in this old thread, exp. the magic prefix trick? I don't know if management issues have been fixed (that we are not using the correct one of the many available Windows APIs for files), but workarounds should work ...

+1
source share

All Articles