学习python--写的copyfile例子

来源:互联网 发布:python sha256.new 编辑:程序博客网 时间:2024/05/22 03:28
import os
import shutil
import string
os.chdir('/home/yijunjun/boost_1_36_0/bin.v2')
print os.getcwd()
os.system("find /home/yijunjun/boost_1_36_0/bin.v2 -name *1.36.0* > name.txt")
file = open("name.txt")
for line in file.readlines():
    sub_dir=os.path.dirname(line)    
    name = os.path.basename(line)
    print sub_dir
    print name
    os.chdir(sub_dir)
    shutil.copy(string.replace(name,'/n',''), '/usr/lib/')
print "copy file over"

原创粉丝点击