copy - How to copy entire content of a local disk in python 3.6?
问题描述
I want to create a .py
file in Python 3.6 that will copy entire local disk partition from my PC (partition D) to external hard drive(partition E). I only managed to copy folders with distutils copytree
command like this:
copy_tree(r"D:\\Myfolder", "E:\\SAVE\\Myfolder", update = True)
But I want the program to copy the entire partition with all folders subfolders and files.
Any help?
解决方案
我找到了答案:
import distutils
from distutils.dir_util import copy_tree
copy_tree(r"D:\\", "E:\\SAVE\\Myfolder", update = True)`
此命令会将所有文件夹从本地磁盘复制到其他位置。
推荐阅读
- jquery - 无法使用 jquery 将 json 转换为 html 列表
- java - Java android中Room的CRUD,如何通过viewmodel将Ripository中Dao和AsyncTask中删除的行数返回给CatalogActivity?
- javascript - 我如何将我的“味精”对象推送到此片段中的空数组中
- xml - 如何删除 unattended.xml Windows 10 中的分区
- jmespath - 逃脱 '。' 在 JMESPath 中
- python - 在字典 Python 中标记单词
- c++ - 每种类型的可变参数模板的调用权模板特化
- node.js - 使用 NestJS 编写 blob 内容的方法是什么?
- django - 如何在没有扩展名的情况下在 django 中获取图像名称
- flutter - Flutter如何让文本字段中的光标停止移动到开头?