You already know, I like the abstraction of pathlib.
I use Python 3.7.4.
import shutil from pathlib import Path src_path = Path("U:\\collections\\2019_input") out_path = Path("U:\\collections\\2019_output") for filename in src_path.rglob('*'): target_file = out_path / filename.name if target_file.exists(): print('File', target_file, 'exists already. Skipping...') continue print(filename, target_file) # shutil.copy2(filename, target_file)Code haven't been tested. You have to be careful, pathlib got some additions, which are not in older versions available.
I use Python 3.7.4.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!