Is there a portable way to copy files in Python?

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Sep 12 10:57:51 EDT 2002


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.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list