어떻게 수정해야할까...?

파일명에 ab가 포함된 jpg만 옮기고 싶은데.. ㅠㅠ 방법좀 부탁해ㅠㅠ



def read_all_file(path):

    output = os.listdir(path)

    file_list = []


    for i in output:

        if os.path.isdir(path+"/"+i):

            file_list.extend(read_all_file(path+"/"+i))

        elif os.path.isfile(path+"/"+i):

            file_list.append(path+"/"+i)


    return file_list


def copy_all_file(file_list, new_path):

    for src_path in file_list:

        file = src_path.split("/")[-1]

        shutil.copyfile(src_path, new_path+"/"+file)

        print("파일 {} 작업 완료".format(file)) # 작업한 파일명 출력


start_time = time.time() # 작업 시작 시간 


src_path = "/Users/BB" # 기존 폴더 경로

new_path = "/Users/class" # 옮길 폴더 경로


file_list = read_all_file(src_path)

copy_all_file(file_list, new_path)