Is there a portable way to copy files in Python?
mwh at python.net
Thu Sep 26 13:35:39 EDT 2002
Duncan Booth <duncan at NOSPAMrcp.co.uk> writes:
> Pierre Rouleau <prouleau at impathnetworks.com> wrote in
> news:3D80A78B.5030206 at impathnetworks.com:
> > I could write code that identifies the operating system (the os.path
> > way) and use os.system("cp " + source_filename + " " + destination) for
> > Unix-type and os.system("copy " + source_filename + " " + destination)
> > but i would prefer to use a simple call.
> > Is this available in the Python library? If not, why is it not part of
> > the library?
> Try the shutil module.
Or distutils.file_copy. I don't like shutil much; somewhere on my
todo list is doing something about that...
> I'm a little confused.
That's because you're Australian! So all the blood flows to
your head, away from the organ most normal guys think with.
-- Mark Hammond & Tim Peters, comp.lang.python
More information about the Python-list