1

Let's say I have files

bla_foo.txt
bla_Foo.txt
bla_bar.txt
xyz_Bar.txt
foo_bla.txt

is it possible to specify several patterns with glob? For example how can I select only *Foo.txt, *foo.txt, *bar.txt and *Bar.txt?

I know how to select only *Foo.txt and *foo.txt with glob('*[Ff]oo.txt'). But what if *bar.txt and *Bar.txt are also acceptable? Is this even possible with glob or will I have to create two globs

glob('*[Ff]oo.txt')
glob('*[Bb]ar.txt')
HappyPy
  • 8,491
  • 11
  • 38
  • 59

0 Answers0