tags:

views:

133

answers:

3

I need to convert paths in 8.3 convention to full path. In Perl, I can use Win32::GetLongPathName() as pointed out in How do I get full Win32 path from 8.3 DOS path with Perl? But, I need to do it in Python.

A: 

Check the win32 extensions.

Aaron Digulla
+1  A: 

Use ctypes. Like this:

from ctypes import *

buf = create_unicode_buffer(260)
GetLongPathName = windll.kernel32.GetLongPathNameW
rv = GetLongPathName(path, buf, 260)
print buf.value

From http://mail.python.org/pipermail/python-win32/2008-January/006642.html

jonasl
It doesn't work.. I tried for path "C:\\progra~1".Empty string returned.
Nelly
I say even more. It returns empty string for long path "C:\\Program Files" too
Nelly
A: 

Use the GetLongPathName function from win32file

Plinio