#!/usr/local/bin/python3
import sys
#将old文件复制为new
def copy(old, new):
sf = open(old)
df = open(new, 'w')
for line in sf:
df.write(line)
df.close
try:
source_file=sys.argv[1] #源文件
des_file=sys.argv[2] #目标文件
except IndexError:
print('Error!正确用法:%s 原文件名 拷贝后的文件名' % sys.argv[0])
else:
copy(source_file,des_file)
print('copy success!')