I need to convert the paths to 8.3 for the full path. In Perl, I can use Win32::GetLongPathName() , as indicated in How to get the full path to Win32 from the 8.3 DOS path with Perl? But I need to do this in Python.
Win32::GetLongPathName()
Use ctypes , which is available in the Python standard without the need to use the pywin32 API . Like this:
ctypes
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
Use the GetLongPathName function from win32file
GetLongPathName
win32file
import win32file print win32file.GetLongPathName(r'C:\progra~1')
outputs:
C:\Program Files