[Python-Dev] A smarter shutil.copytree ?

Tarek Ziadé ziade.tarek at gmail.com
Thu Apr 17 19:02:57 CEST 2008


>  --------------------- copying a source to a target, but the pyc/pyo file
>  def filtering(source, target):
>     return os.path.splitext(filename) not in ('.pyc', '.pyo')
>
>  shutil.copytree(source, target, filter_=filtering)
>  ---------------------

oups, made a mistake in my example:

def filtering(source_path, target_path):
    return os.path.splitext(source_path) not in ('.pyc', '.pyo')

shutil.copytree(source, target, filter_=filtering)


More information about the Python-Dev mailing list