How do I copy folders using python? Shutil.copy doesn't work. it raises a permission denied error in windows

Recommended Answers

All 7 Replies

what permission error does it give? and only on windows?

from the api, copy should only have a file as its source so you shouldn't be able to copy folders using it. maybe shutil.copytree is what you are looking for?

how does shutil.copytree work?

If you're getting a permission denied error, that usually indicates that your program doesn't have enough privileges to do what it wants to do. Where are you copying the file to? And is this a Vista OS?

I'm not copying a file. I'm trying to copy a folder and I'm using win XP

I assume you are able to copy this using explorer? anyway, look up the api on how to use the copytree method.

does copytree overwrite any folders that already exist?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.