import os import shutil import os from params import * def copytree(old_file_path,new_file_path): if os.path.exists(new_file_path): try: for i in os.listdir(new_file_path): txt_path = os.path.join(new_file_path, i) os.remove(txt_path) os.rmdir(new_file_path) except Exception as result: print("报错:%s" % result) shutil.copytree(old_file_path, new_file_path) if __name__ == '__main__': copytree(old_file_path,new_file_path)