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.
You can make your own ignore function:
Or, if you want to be able to call
copytree
with a relative path:From the docs: