python copy文件夹内的文件

python 筛选文件代码

import os
import shutil
def readfilename(file_path):
    for root,dirs,files in os.walk(file_path):
        return root ,dirs,files
def deletefile(root, dirs, files):
    a=1
    for ii in files:
        a=a+1
        file1=os.path.join(root,ii)
        if a%7==0:
            shutil.copy(file1,"F:\\ye\\chulihou")
            print("delete")
        else:
            continue
if __name__=="__main__":
    root,dirs,files=readfilename(u"F:\\ye\\xiaowujian")
    deletefile(root,dirs,files)

你可能感兴趣的:(python记录,python)