Re: Case-insensitive globbing

From: Eddie Corns (eddie_at_holyrood.ed.ac.uk)
Date: 06/03/04


Date: Thu, 3 Jun 2004 18:03:15 +0000 (UTC)

tkpmep@hotmail.com (Thomas Philips) writes:

>I'm using the function glob from module glob to obtain a list of all
>files in a directory that match a pattern. Unfortunately, some
>filenames are in upper case, others are in lower case and yet others
>are in mixed case. How can I do a case-insenstive glob that picks up
>all files that match a string regardless of case? If its any help, I'm
>running Python 2.3.4 under Windows XP.

If it works the same as it does on Unix then you can use the [Xx] construct
for each of the characters, eg *[Ff][Oo][Oo]* but I'll bet there are better
ways to do the task.

Eddie



Relevant Pages

  • Re: Volte-face by GFS
    ... Well I wasn't talking about blocking, my analysis was talking about a cold ... plunge and a transition to a longwave upper trough near the meridian or just ... "topplers" occur in a progressive pattern with a two day ... likely to experience in the UK; not weather from the continent which ...
    (uk.sci.weather)
  • Re: Design help please
    ... I am now ONLY able to see it run from upper right to lower left. ... wife, when she sees it, thinks that the pattern of the hollow blocks ... flow from top left to bottom right. ... Whichever you choose to pronounce. ...
    (rec.crafts.textiles.quilting)
  • Re: Still blocked
    ... particular pattern, due to the configuration of the jetstream over a ... Essentially it is caused when an upper ridge exists just to the east ... upper air configuration, ...
    (uk.sci.weather)
  • Re: Picasa bug abbreviates some filenames
    ... I normally name a photo so that it starts with the ... So you could bulk rename your files ... sure you have the pattern right - rename preview and undo rename ... You can also use Picnam to add your date/times to the filenames if the ...
    (rec.photo.digital)
  • Re: Still blocked
    ... particular pattern, due to the configuration of the jetstream over a ... Essentially it is caused when an upper ridge exists just to the east ... upper air configuration, ...
    (uk.sci.weather)