0

I have the following:

for root, dirs, files in os.walk(pathToSearch):
            for file in files:
                if file.endswith(fileTypeToSearchFor):

It works well, it searches through and brings back files. What I'm struggling with though is if fileTypeToSearchFor is 'JPG' it misses all the 'jpg' files and vice versa. It's fully case sensitive.

Is there a way that os.walk can retrieve a file list with endswith where it's not case sensitive?

Thanks a tonne...

robster
  • 481
  • 1
  • 3
  • 15

0 Answers0