I'd like to specify full paths to ignorable files and directories when calling shutil.copytree(). Something like
def my_ignore(dir, files):
# return ["exclude.file"] # working
return ["/full_path_to/exclude.file"] # Not working
shutil.copytree(src, dest, ignore=my_ignore)
After this, the excluded file is still there unless I return simply the filename instead of full path. The thing is I really want to set up a particular file instead of all matching filenames under different directories.
I referred to a number of questions here, such as: How to write a call back function for ignore in shutil.copytree
Filter directory when using shutil.copytree?
But none of the answers work. It looks like the ignore hook can only return a glob-style and any constructed full path will not work.
Am I missing something?