import os,shutil
import numpy as np
def GetImgNameByEveryDir(file_dir,videoProperty):
# Input Root Dir and get all img in per Dir.
# Out Every img with its filename and its dir and its path
# videoProperty=['.png','jpg','bmp']
for root, dirs, files in os.walk(file_dir):
for file in files:
if os.path.splitext(file)[1] in videoProperty:
FilePath = os.path.join(root, file)
FileNewPath = './你的目标文件夹/' + file
if os.path.exists(FileNewPath)==False:
shutil.copyfile(FilePath,FileNewPath)
print(os.path.join(root, file))
Dir = './'
FileName,FileNameWithPath,FileDir = GetImgNameByEveryDir(Dir,'.jpg')