Case insensitive exists()?

Dan Sommers dan at tombstonezero.net
Thu Jan 23 02:51:30 EST 2014


On Wed, 22 Jan 2014 18:18:32 -0700, Larry Martell wrote:

> The issue is that I run a database query and get back rows, each with
> a file path (each in a different dir). And I have to check to see if
> that file exists. Each is a separate search with no correlation to the
> others. I have the full path, so I guess I'll have to do dir name on
> it, then a listdir then compare each item with .lower with my string
> .lower. It's just that the dirs have 100's and 100's of files so I'm
> really worried about efficiency.

Okay, so it's not Python, and I have the benefit of having read all of
the other answers, but what about calling "locate" [0] with the "-i"
flag? or writing some sort of Python/ctypes wrapper around the part of
locate that searches the database?

Dan

[0] http://savannah.gnu.org/projects/findutils/



More information about the Python-list mailing list