[Tutor] File copying - best way?

fleet@teachout.org fleet@teachout.org
Sat, 4 Aug 2001 21:22:05 -0400 (EDT)


Between
   os.popen("cp /path1/newfile /path2/oldfile")
and
   open("/path1/newfile","w").write(open("/path2/oldfile","r").read())

Which, if either, is the "preferred" method of copying a file?  The second
will raise an IOError if it fails.  I have no clue how to test the first.

Are there other and/or better methods of copying a file?

				- fleet -