Python utility convert Windows long file name into 8.3 DOS format

Simon Brunning simon.brunning at gmail.com
Thu Oct 28 03:13:11 EDT 2004


On Thu, 28 Oct 2004 06:47:28 GMT, Ben Kial <benkial at hotmail.com> wrote:
> Is there a Python program to convert Windows long filename, like "c:\Program
> Files" into the old DOS 8.3 format, like "c:\Progra~1"?

>>> import win32api
>>> win32api.GetShortPathName('D:/share/from_roadwarrior/simon/python/RandomizeScreenSaver/RandomizeScreenSaver.pyw')
'D:/share/FROM_R~1/simon/python/RANDOM~1/RANDOM~1.PYW'

-- 
Cheers,
Simon B,
simon.brunning at gmail.com,
http://www.brunningonline.net/simon/blog/



More information about the Python-list mailing list