#!/usr/bin/python3
import shutil
import os
def move(src, dst):
from_file_path = src
to_file_path = dst
if os.path.exists(from_file_path):
if os.path.exists(to_file_path):
shutil.move(from_file_path, to_file_path)
else:
print("目的路径失效,找不到指定路径")
else:
print("源路径文件不存在")
if __name__ == "__main__":
move("english.txt", "/root/") import shutil
import os
file="J2010.pdf"
to_path="D:\study"
if os.path.exists(file):
if os.path.exsits(to_path):
shutil.move(file,to_path)
else:
print("No such path")
else:
print("The file does not exist")