-1

i have a dataset and one folder and in this folder i have a few subfolder in them there is audio file i need to move on the whole subfolders and get the file and the path , i using python osomeone has idea?

folder: dataset -> folders: rock,regge,hiphop,classic,disco,jazz,pop,blues,country,metal -> files: "name".wav i need to enter each folder and get the file and path. i have 100 files in folder.

i dont try nothing because i dont know how to do that

d.z
  • 11
  • 3

1 Answers1

1

You should use os.walk

import os

for subdir, dirs, files in os.walk(rootdir):
    for file in files:
        filepath = subdir + os.sep + file    
        if filepath.endswith(".wav"):
            print(filepath)
Yash Kanojia
  • 154
  • 10