It should be possible to implement copying filters similar to `tarfile` extraction filters: https://docs.python.org/3/library/tarfile.html#extraction-filters