Is there a portable way to copy files in Python?
prouleau at impathnetworks.com
Thu Sep 12 10:41:15 EDT 2002
I have been using os.system() with the operating system 'cp' or copy
commands when i want to copy files. I can use os.mkdir() to make
directories, but i can't find a os.filecopy() or os.path.filecopy() or
os.copy() or something like that. I must be missing something, since
such a basic operation is likely to be needed by Python library users.
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
Thanks for your time!
More information about the Python-list