mihaix
mihaix

Reputation: 31

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?

Upvotes: 2

Views: 981

Answers (1)

mihaix
mihaix

Reputation: 31

I find the answer:

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

This command will copy all folders from local disk to other location.

docs

Upvotes: 1

Related Questions