Path: csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.014 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'exist,': 0.07; 'filename': 0.07; 'trailing': 0.07; 'python': 0.09; 'sep': 0.09; 'ignore': 0.13; '2.7.2': 0.16; 'extensions,': 0.16; 'received:mail- wi0-f178.google.com': 0.16; 'wrote:': 0.17; 'bytes': 0.17; 'thu,': 0.17; 'windows': 0.19; 'file.': 0.20; 'recognize': 0.22; '(this': 0.24; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'received:209.85.212': 0.28; 'subject:end': 0.29; 'file': 0.32; 'skip:8 10': 0.32; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'subject:with': 0.36; 'subject: (': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'free': 0.61; 'world': 0.63; 'due': 0.66; 'serial': 0.66; 'periods.': 0.84; 'to:name:python': 0.84; 'period.': 0.95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=H5vp+M7WAiIG75d0/kSLwctqy3gv5r/C1qkH2rDNnW8=; b=0SLkyx7ICxsjUHlz8WmCX5SdId9/bKVoJpFJ8Dp3GbJ1fJ9YvEjuFZeSwx0m3+ff49 zCrKhpnvV41l93PU0bGjIzaLpLo4JOFBcsmVsqzR1REsTMQr8aS1Z0n8Y9P2x3IRrSPf 8Smn1M7FHQ8M61znKoZREtnQAUlAN+gmQFNdKPNdV/cVOQANizXzWjNw2YpxR2V1uB0T DcvzcOPc2sItTByJRQlBGOTQfAXOSRQ9JkVl+0JHPl5ChpLht1JrrOlvi2xlFFqoEY0S hyW1ZSqoT0Hd4HEdh4zywx9+2EnVcuu8IpyTjX8dJw8XJVAT19oyTLnY5AJcUjsbr2ZM NMOg== MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Thu, 6 Sep 2012 21:12:01 -0600 Subject: Re: os.stat() distorts filenames that end with period (nt.stat()) To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346987553 news.xs4all.nl 6923 [2001:888:2000:d::a6]:57648 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28674 On Thu, Sep 6, 2012 at 6:55 PM, ruck 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