On Sep 25, 8:38 pm, Stef Mientki <[EMAIL PROTECTED]> wrote:
> I found a partial workaround that is good enough for me:
>
> def Get_Windows_Filename ( FileName ) :
>   if os.name == 'nt' :
>     File = os.path.splitext ( FileName .lower ())[0]
>     return glob.glob ( File + '.p?' )
>   return FileName
>
> This will translate the filename into the correct case, but not the path.
>
> I also looked at os.path.walk, but that's too slow for me,
> because getting the path correct means I have to start at the root.
>
You could try win32api.GetLongPathName(...). However, I've found that
some parts of the path are converted to the correct case but other
parts aren't:

>>> print win32api.GetLongPathName(r"c:\documents and 
>>> settings\administrator\desktop\foobar.py")
c:\documents and settings\administrator\Desktop\FooBar.py

How does your solution compare to using os.listdir(...) instead of
glob?
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to