File size: 437 Bytes
b4f3fce
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
# Print the number of audio files in each directory

import os

for dir in os.listdir("."):

    if not dir.startswith(".") and os.path.isdir(dir): # Ignore hidden dirs and files
        files = os.listdir(dir)
        mp3_files = [f for f in files if f.endswith(".mp3")] # Only list mp3 files
        wav_files = [f for f in files if f.endswith(".wav")] # Only list mp3 files

        print(f"{dir}: {len(mp3_files) + len(wav_files)}")