os.stat() distorts filenames that end with period (nt.stat())
Ian Kelly
ian.g.kelly at gmail.com
Thu Sep 6 23:12:01 EDT 2012
On Thu, Sep 6, 2012 at 6:55 PM, ruck <john.ruckstuhl at gmail.com> wrote:
> (This with Python 2.7.2 on Windows 7)
>
> os.stat() won't recognize a filename ending in period.
> It will ignore trailing periods.
> If you ask it about file 'goo...' it will report on file 'goo'
> And if 'goo' doesn't exist, os.stat will complain.
Due to the weirdness of Windows filename extensions, these names refer
to the same file.
C:\Users\Ian>echo hello > goo
C:\Users\Ian>type goo
hello
C:\Users\Ian>type goo.
hello
C:\Users\Ian>type goo..
hello
C:\Users\Ian>type goo...
hello
C:\Users\Ian>echo world > goo...
C:\Users\Ian>dir goo*
Volume in drive C is OS
Volume Serial Number is 9881-66F0
Directory of C:\Users\Ian
09/06/2012 09:10 PM 8 goo
1 File(s) 8 bytes
0 Dir(s) 8,884,142,080 bytes free
C:\Users\Ian>type goo
world
More information about the Python-list
mailing list