Getting correct file names under Windows

Thomas Heller thomas.heller at ion-tof.com
Thu Feb 7 12:54:34 EST 2002


"Eric Brunel" <eric.brunel at pragmadev.com> wrote in message news:a3ud3i$17g3$1 at norfair.nerim.net...
> Hi all,
>
> Windows case insensitivity striked again: I've got a Python/Tkinter program
> that uses the new tk function named tk_chooseDirectory (new in Tk 8.3),
> displaying a directory selection dialog. For some reason, this function
> insists in returning the selected directory all uppercase. Unfortunately,
> even if Windows does not care about case, we definetely don't want that: the
> disk we work on is mounted from a Samba Unix - therefore case sensitive -
> server, and we want to use the same file names on both environments.
> So I tried to get the "real" file name, i.e. the one that is defined on
> Unix, and the one I actually see in Windows Explorer or DOS windows. I
> didn't succeed...
>
> Does anybody know any way to get the "real" name of a file or directory
> under Windows, i.e. the one that Explorer displays?
You know that the Explorer doesn't always display the correct case?
There's an option somewhere (Enable Uppercase Filenames or so).

To your original question: win32api.FindFiles() and os.listdir()
returns filenames in the correct case.

Thomas





More information about the Python-list mailing list