import errno
import gzip
import os
-
+import shutil
def make_dirs(dirname):
try:
f.write(fobj.read())
f.close()
return output_path
-
-# def decompress_bunzip(intput_path, output_path):
-# with open(output_path, 'wb') as new_file, bz2.BZ2File(intput_path, 'rb') as file:
-# for data in iter(lambda : file.read(100 * 1024), b''):
-# new_file.write(data)
-
-
\ No newline at end of file
+def copyfile(src, dst, filename=None):
+ abs_dst=os.path.abspath(os.path.expanduser(dst))
+ make_dirs(abs_dst)
+ if filename:
+ abs_dst = os.path.join(abs_dst, filename)
+ shutil.copy(src, abs_dst)
+ if filename:
+ return abs_dst
+ return os.path.join(abs_dst, os.path.basename(src))
\ No newline at end of file