Copying Huge Files ? (Newbie!)
Skip Montanaro
skip at mojam.com
Thu Aug 12 14:40:47 EDT 1999
Matthias> But while reading the manual I cannot find something like
Matthias> os.copyfile or os.movefile.
Matthias> Are there some functions except open/read/write that can do
Matthias> the copy for me ???
Matthias,
You'll have to open the input and output file, then read and write chunks
yourself, for example (untested!):
def copy(fromfile, tofile, chunksize=8192):
f = open(fromfile, "rb")
t = open(tofile, "wb")
data = f.read(chunksize)
while data:
t.write(data)
data = f.read(chunksize)
f.close()
t.close()
Skip Montanaro | http://www.mojam.com/
skip at mojam.com | http://www.musi-cal.com/~skip/
847-971-7098
More information about the Python-list
mailing list