Need to get 8.3 path on Windows

Patrick L. Nolan pln at razzle.Stanford.EDU
Sat Jan 17 02:09:05 EST 2004


Our python script uses popen to run an application on Windows XP.
The application chokes if the filename given as a command line
argument contains any spaces.  It's happy with the 8.3 shortname 
notation, though.  So given a file with a name like
 c:\Documents and Settings\Joe User\Desktop\My Files\foo.dat
I would like to be able to convert this to
 c:\DOCUME~1\JOEUSE~1\Desktop\MYFILE~1\foo.dat

This would be a fairly simple exercise in text manipulation
except that the number may not always be 1.  If the directory
names are not unique in the first 6 characters, there may
be ~2 etc.

Has this been solved by someone else?  

-- 
*   Patrick L. Nolan                                          *
*   W. W. Hansen Experimental Physics Laboratory (HEPL)       * 
*   Stanford University                                       *



More information about the Python-list mailing list