Skip to content Skip to sidebar Skip to footer

How To Copy A Folder (divide Into Sub Folders) Using Python?

i try to copy a directory (divided into folders and subfolders) to a new folder that will be created.i work with python 2.7. dir_src = an exist folder dir_dst = a new folder (not

Solution 1:

The error you are getting (Permission denied) should tell you what is the problem - you don't have rights to read or copy the files. Running the program as administrator should fix it.

Solution 2:

About edited question and error:

WindowsError: [Error267] : 'C:\\Project\\layers\\abc.cpg/*.*'

Please carefully read docs

import shutil

dir_src = r"C:\Project\layers"
dir_dst = r"C:\Project\new" 
shutil.copytree(dir_src, dir_dst)

you not need any for.

Note: Please keep in mind, that destination path shouldn't be existed.

Post a Comment for "How To Copy A Folder (divide Into Sub Folders) Using Python?"