script.py: #!/usr/bin/python import os srcDir = os.getcwd() dirName = 'target_directory' dstDir = os.path.abspath(dirName) def ignore_list(path, files): filesToIgnore = [] for fileName in files: fullFileName = os.path.join(os.path.normpath(path), fileName) if not os.path.isdir(fullFileName) and not fileName.endswith('pyc') and not fileName.endswith('ui') and not fileName.endswith('txt') and not fileName == '__main__.py' and not fileName == 'dcpp.bat': filesToIgnore.append(fileName) return filesToIgnore # start of script shutil.copytree(srcDir, dstDir, ignore=ignore_list) As shutil.copytree() has no option where i can give names for required files to copy like "ignore" so in the above code i have modified the argument of ignore to give "required files to copy" Review my code