[Python] How to create a simple status/count/progress output when searching for files using...

Discussão em 'Python' iniciado por Stack, Junho 7, 2025.

  1. Stack

    Stack Membro Participativo

    I have a simple line that searches for all .json files, except there are about 28k of them, so this one line takes about a minute to complete:

    from pathlib import Path

    files = list(Path("~/foo/bar/).rglob("*.json"))


    Is there a way to create a simple counter that shows the user how many rglob() found so far? Or even a harder solution where there's an estimated progress bar since I know the total number is around 28k (but this number slowly grows in future updates)?

    I prefer rich over tqdm, but any solution is better than nothing. Thanks.

    Continue reading...

Compartilhe esta Página