dyc99
import shutil
import os
from shutil import make_archive


# 查看可压缩的文件类型
print(shutil.get_archive_formats())
# 压缩文件原始与压缩文件存放的根目录
rootPath = r\'F:/BaiduNetdiskDownload/COVID-19CTSeg/3DUNet-Pytorch/test\'
# 压缩文件存放目录
# Myarchive:压缩文件名
# archive_name = os.path.expanduser(os.path.join(rootPath, \'Myarchive\'))
# # 被压缩文件路径
# root_dir = os.path.expanduser(os.path.join(rootPath, \'\'))
# make_archive(archive_name, \'gztar\', root_dir)

# copyfile
from shutil import copyfile
from shutil import copytree
import logging

def _logpath(path, names):
    logging.info(\'Working in %s\', path)
    return []   # nothing will be ignored
source = r\'F:/BaiduNetdiskDownload/COVID-19CTSeg/3DUNet-Pytorch/label\'
destination = r\'F:/BaiduNetdiskDownload/COVID-19CTSeg/3DUNet-Pytorch/test\'
copytree(source, destination, ignore=_logpath)

# https://docs.python.org/3/library/shutil.html?highlight=copyfile#shutil-platform-dependent-efficient-copy-operations

分类:

技术点:

相关文章:

  • 2021-07-02
  • 2022-12-23
  • 2021-11-30
  • 2021-06-04
  • 2022-12-23
  • 2021-11-21
  • 2021-11-09
猜你喜欢
  • 2021-11-21
  • 2022-12-23
  • 2022-02-07
  • 2022-01-13
  • 2021-11-30
  • 2022-02-07
  • 2021-11-24
相关资源
相似解决方案