I’m trying to use python to copy a tree of files/directories.
is it possible to use copytree to copy everything that ends in foo?
There is an ignore_patterns patterns function, can I give it a negated regular expression? Are they supported in python?
eg.
copytree(src, dest, False, ignore_pattern(‘!*.foo’))
Where ! means NOT anything that ends in foo.
thanks.
shutil.copytreehas anignorekeyword.ignorecan be set to any callable. Given the directory being visited and a list of its contents, the callable should return a sequence of directory and filenames to be ignored.For example: