using os module to copy files on windows

Steve Holden sholden at holdenweb.com
Tue Apr 10 15:49:32 EDT 2001


"Christian Reyes" <christian at rocketnetwork.com> wrote in message
news:9avnkk$23$1 at bob.news.rcn.net...
> Hello,
> I've been using the os.system() call to copy files using the dos cmd line
in
> my python scripts.
> for instance.
>
> os.system('xcopy d:\\folder\\* d:\\folder2\\')
>
> this does the job fine, but i'd like to eradicate all dependencies on the
> cmd line from my scripts.
>
> Is there a python os method that is equivalent to this?
>
Take a look at the shutil module. With the caveat that Macintosh resource
forks will be lost, this appears to be a portable equivalent of your sample
code.

regards
 Steve






More information about the Python-list mailing list