2016-07-16 2 views
-2

그 안에 여러 개의 디렉토리가있는 디렉토리가 있습니다. 하위 디렉토리에는 각각 jpeg 이미지가 있습니다. 이러한 이미지를 추출하여 파이썬을 사용하여 단일 폴더로 복사하는 방법을 찾도록 도와 줄 수 있습니까? 사전여러 폴더에서 jpeg 파일을 검색하기위한 python 스크립트

당신이 예를 들면 할 수
+1

http://stackoverflow.com/a/30255302/4889267이 관련된 작업의 90 %를 가지고있다. 그것을 확인해주세요 – AK47

+2

1. [파일 찾기] (http://stackoverflow.com/questions/18394147/recursive-sub-folder-search-and-return-files-in-a-list-python) 2. [파일 복사 ] (https://docs.python.org/3/library/shutil.html#shutil.copy2) – Delgan

답변

0

에서

감사 :

import glob, os 
from shutil import copyfile 

os.chdir("yourdirectory") 
for file in glob.glob("*.jpeg"): 
    copyfile(file, "destinationdirectory/"+file) 
관련 문제