首页 > 解决方案 > 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?

标签: copy

解决方案


我找到了答案:

import distutils
from distutils.dir_util import copy_tree
copy_tree(r"D:\\", "E:\\SAVE\\Myfolder", update = True)`

此命令会将所有文件夹从本地磁盘复制到其他位置。

文档


推荐阅读