Skip to main content

Looks ok for a specific task, but the code is not reusable at all. It would be more useful to create a function ignore_except that could be used like this to perform the same task:

shutil.copytree(srcDir, dstDir, 
                ignore=ignore_except('*.pyc', '*.ui', '*.txt', '__main__.py', 'dcpp.bat'))

The source code of shutil.ignore_patterns would be a good starting point for such function.

Janne Karila
  • 10.7k
  • 21
  • 34