Sorry, I made a mistake copying and pasting. I believe the second example should be something like: if file.endswith("primary.xml.zst") or file.endswith("primary.xml.gz"):