Python utility convert Windows long file name into 8.3 DOS format

Steve Holden steve at holdenweb.com
Thu Oct 28 08:07:57 EDT 2004


vincent wehren wrote:

> Simon Brunning wrote:
> 
>> On Thu, 28 Oct 2004 10:55:16 +0200, vincent wehren
>> <vincent at visualtrans.de> wrote:
>>
>>> Just note that GetShortPathName expects a valid and accessible path in
>>> your file system.
>>
>>
>>
>> Which is just as it should be. Files that don't exist don't *have*
>> short names. One might be able to put together a function that
>> *guesses* what short name Windows would be likely to give a new file
>> with a given long name, but it would be pretty unreliable, I reckon.
>>
> 
> Exactly. And on top of that, there may be situations where files that 
> *do* exist *don't* have a 8.3 alias, making any such guesswork even 
> harder. So in retrospect, the correct answer to OP's question should be: 
> "No. There is no conversion utility", as the relationship between long 
> name - short name is not on of a-to-b conversion.
> 
well that's new information to me, so thanks - I just assumed that any 
long filename could be munged. But I think that it's just useful 
additional information rather than the "correct answer", since by itself 
it would have been rather less than helpful to the OP :-)

regards
  Steve
-- 
http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119



More information about the Python-list mailing list