简体   繁体   中英

Copy folder with new name - python

I'm new in python... How I copy a folder to other scr with a new name? Example:

copy from
**c:/dir01
to
d:/dir02**

I tried:

shutil.copytree(path, pathDest1) 

I think thedocumentation is really clear about this:

Recursively copy an entire directory tree rooted at src, returning the destination directory. The destination directory, named by dst, must not already exist.

You can import shutil , and call copy tree.

import shutil

# Give the destination any name you wish.
copytree(path, pathDest1)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM