copy directory from a to b, how?

davec999 at my-deja.com davec999 at my-deja.com
Mon Mar 27 06:13:26 EST 2000


In article <8bne0u$jlu$1 at nnrp1.deja.com>,
tiddlerdeja at my-deja.com wrote:
> I'd like to copy a directory from c:/Inetpub/staging to
> c:/Inetpub/wwwroot.
>
> How do I do this in Python? I know that I have shutil.copytree() at my
> disposal, but this requires that the destination directory doesn't
> exist. I don't want to remove c:/Inetpub/wwwroot so that I can perform
> the copy.
>
> What is the best way to do this? Any help appreciated.
Is is essential to do it in Python? I would use the line:
os.system("xcopy c:\\inetpub\\staging c:\\inetpub\\wwwroot\\ /E")
Remember the backslashes in the correct place (at the end of the second
argument and not at the end of the first) and you should be fine.
Of course, if you want it to work on multiple OSs this will obviously
not work. :)
Dave


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list