DEV Community

gunteh
gunteh

Posted on • Originally published at stackoverflow.com

Python 3.X : rglob with FileNotFoundError: [WinError 3] The system cannot find the path specified

More details of issue on StackOverflow:

def collate_files(old_dir, new_dir) -> str:
for subfolder in old_dir.rglob('*.xlsx'):

if subfolder.match("string_title"):
new_dir= new_dir.joinpath(subfolder)
if Path.exists(new_dir):
pass
else:
try:
shutil.copy(subfolder, new_dir, follow_symlinks=True)
except OSError as e:
raise e

Top comments (0)