Short form of file names

Guido van Rossum guido at python.org
Fri Jul 6 15:42:25 EDT 2001


Skip Montanaro <skip at pobox.com> writes:

>     Mikhail> Is there some Python module for converting Windows long paths
>     Mikhail> to short form, i.e. 8.3? os.path.normpath() does not do this..
> 
> Try importing dospath directly:
> 
>     >>> import dospath
>     >>> dospath.normpath("/supercalifragilisticexpealidocious.py")
>     '\\supercal.py'

Yeah, but shouldn't it return '\\superca~1.py' ?  I believe the
algorithm to produce the ~1 part is dependent on what else is in the
same directory.  I guess the ActiveState win32 modules hide an API
somewhere that gets this information directly from the filesystem.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-list mailing list