#!/usr/bin/python
# -*- coding: utf-8 -*-
import os,shutil
subfix="RED.bmp"
dstfile_prefix='./RED/'
cnt_start=178
def process_files(path):
? ? cnt=cnt_start
? ? for root , dirs, files in os.walk(path):
? ? ? ? for name in files:
? ? ? ? ? ? if name.endswith(subfix):
? ? ? ? ? ? ? ? cnt+=1
? ? ? ? ? ? ? ? srcfile=os.path.join(root, name)
? ? ? ? ? ? ? ? print(cnt,name)
? ? ? ? ? ? ? ? dstfile=dstfile_prefix+str(cnt)+".bmp"
? ? ? ? ? ? ? ? shutil.copyfile(srcfile,dstfile)? ? ?
if __name__ == "__main__":
? ? path = './body'
? ? process_files(path)