remove_data.py 552 B

12345678910111213141516171819202122
  1. import os
  2. import shutil
  3. import os
  4. from params import *
  5. def copytree(old_file_path,new_file_path):
  6. if os.path.exists(new_file_path):
  7. try:
  8. for i in os.listdir(new_file_path):
  9. txt_path = os.path.join(new_file_path, i)
  10. os.remove(txt_path)
  11. os.rmdir(new_file_path)
  12. except Exception as result:
  13. print("报错:%s" % result)
  14. shutil.copytree(old_file_path, new_file_path)
  15. if __name__ == '__main__':
  16. copytree(old_file_path,new_file_path)