找出jpg 和 json, 并copy到 一个新的文件夹

 

$ cat filter.py
import os
import sys
from os import walk
from os import listdir
import glob
from shutil import copy2

mypath = './'
dst = './test'

#jpgs = glob.glob(os.path.join(mypath, '*.jpg'))
#print(jpgs)

for f in listdir(mypath):
    if f.endswith("jpg"):
       print(f)
       copy2(f,dst)

       j = f.replace("jpg","json")
       print(j)
       copy2(j,dst)

  

posted on 2019-10-16 11:07  cdekelon  阅读(143)  评论(0编辑  收藏  举报

导航