import shutil
import os

#目录自己改一下即可,复制
path = "./static/imgs/"   
new_path = "./static/upload/"

for file in os.listdir(path):
    full_file = os.path.join(path, file)
    new_full_file = os.path.join(new_path, file)
    shutil.copy(full_file, new_full_file)


# 删除目录,在新建相同目录
shutil.rmtree(path)
os.mkdir(path)

 

相关文章:

  • 2022-01-14
  • 2021-10-08
  • 2021-07-13
  • 2022-12-23
  • 2022-01-14
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-12
  • 2021-11-12
  • 2022-12-23
  • 2021-08-11
  • 2021-10-14
  • 2022-12-23
相关资源
相似解决方案