How can I transform a shortened path to full path in python? For example take this full path
C:\Test\PathToMyDirectoryWithLongName\test.txt
which got transformed into
C:\Test\PATHTO~\test.txt.
How do I transform it back?
Using win32api.GetLongPathName:
>>> win32api.GetLongPathName(r'c:\progra~1')
'c:\\Program Files'
and win32api.GetShortPathName:
>>> win32api.GetShortPathName(r'c:\Program Files')
'c:\\PROGRA~1'
NOTE: You need to install pywin32 to use above functions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With