Filter directory when using shutil.copytree?
Is there a way I can filter a directory by using the absolute path to it? shutil.copytree(directory, target_dir, ignore = shutil.ignore_patterns("/Full/Path/To/aDir/Common")) This doesn't seem to work when trying to filter the "Common" Directory located under " aDir ". If I do this: shutil.copytree(directory, target_dir, ignore = shutil.ignore_patterns("Common")) It works, but every directory called Common will be filtered in that "tree", which is not what I want. Any suggestions ? Thanks. phihag You can make your own ignore function: shutil.copytree('/Full/Path', 'target', ignore=lambda