Commit 109c7f5d by willmcgugan

Beginning a utils module to keep various fs related functions in...

parent 539f4be6
......@@ -16,12 +16,21 @@ def copyfile(src_fs, src_path, dst_fs, dst_path, chunk_size=1024*16):
shutil.copyfile(src_syspath, dst_syspath)
return
src = src_fs.open(src_path, 'rb')
dst = dst_fs.open(dst_path, 'wb')
src, dst = None
# Chunk copy
while True:
chunk = src.read(chunk_size)
if not chunk:
break
dst.write(chunk)
try:
# Chunk copy
src = src_fs.open(src_path, 'rb')
dst = dst_fs.open(dst_path, 'wb')
while True:
chunk = src.read(chunk_size)
if not chunk:
break
dst.write(chunk)
finally:
if src is not None:
src.close()
if dst is not None:
dst.close()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment