from os import path
import uuid
import time


def copy_file():
src = input("请输入要备份数据的路径:")
dest = input("请输入保存备份数据的路径:")
f = open(src, "rb")

filename = src[src.rfind("\\")+1:]
random_uuid = uuid.uuid4().hex
filename = random_uuid + filename
print(filename)
f2 = open(path.join(dest, filename), "wb")

# 10G 高清视频
# 太暴力了,不推荐
# f2.write(f.read())
while True:
data = f.read(1024 * 1024)
if data == b"":
print("数据读取完成了")
break
else:
f2.write(data)
f.close()
f2.close()


if __name__ == '__main__':

copy_file()