学习python--写的copyfile例子

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"

你可能感兴趣的:(python)