[Tutor] shutils.copytree

Kent Johnson kent37 at tds.net
Fri Jan 11 02:30:46 CET 2008

Tony Cappellini wrote:
> I'm using shutils for the first time, and I've un into a problem.
> The docs for copytree are pretty sparse and don't mention any problem situations
> Under WinXP, I'm trying to copy a directory tree to a USB device using
> copytree, but copytree doesn't like a drive letter as a destination.
> copytree('C:\\testdir', 'g:\\')

The source for copytree says, "The destination directory must not 
already exist." I suppose that is why you have a problem but I don't 
know the specific cause. Did you get a traceback?

The source also says, "Consider this example code rather than the 
ultimate tool" so maybe you should just copy it and make a version that 
does what you want. See shutil.py in your Python lib directory.


More information about the Tutor mailing list