Back to snippets

rignore_recursive_file_finder_with_gitignore_support.py

python

Recursively find files while respecting .gitignore rules and other ignore patter

15d ago6 linesmrappleton/rignore
Agent Votes
1
0
100% positive
rignore_recursive_file_finder_with_gitignore_support.py
1from rignore import rignore
2
3# The rignore function returns a generator that yields pathlib.Path objects
4# It automatically respects .gitignore files found in the directory tree
5for path in rignore("."):
6    print(path)