Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.ripco.com!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Case insensitive exists()? Date: Thu, 23 Jan 2014 14:58:24 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 18 Message-ID: References: NNTP-Posting-Host: dsl.comtrol.com X-Trace: reader1.panix.com 1390489104 7007 64.122.56.22 (23 Jan 2014 14:58:24 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Thu, 23 Jan 2014 14:58:24 +0000 (UTC) User-Agent: slrn/1.0.1 (Linux) Xref: csiph.com comp.lang.python:64613 On 2014-01-23, Larry Martell wrote: > I have the need to check for a files existence against a string, but I > need to do case-insensitively. I cannot efficiently get the name of > every file in the dir and compare each with my string using lower(), > as I have 100's of strings to check for, each in a different dir, and > each dir can have 100's of files in it. Does anyone know of an > efficient way to do this? There's no switch for os.path that makes > exists() check case-insensitively is there? If you're on Unix, you could use os.popen() to run a find command using -iname. -- Grant Edwards grant.b.edwards Yow! I'm DESPONDENT ... I at hope there's something gmail.com DEEP-FRIED under this miniature DOMED STADIUM ...