一、概述 shutil listdir splitext copy os.path.join 二、实例 1.复制文件 import shutil shutil.copy("rockdev/Image/system.img","/home/VirtualBox-Share/MydroidDevTool_v1.23/rockdev/Image/") print "copy [system] image success." 2.复制文件夹内指定文件 import shutil import os SRC = "rockdev/Image/" DST = "/home/VirtualBox-Share/MydroidDevTool_v1.23/rockdev/Image/" for file in os.listdir(SRC): if os.path.splitext(file)[1] == ".img": print file shutil.copy(os.path.join(SRC,file), DST) print "copy [all] images success."