Check a directory for all files of a certain filetype
python
Solution
this will make a list of all the filenames and then check if they end with .wav
import os
listdirectory = os.listdir(".") # gets the name of all files in your dir
for filename in listdirectory:
if filename.endswith(".wav"): # check each of the files for whether or not they end in .wav
Problem
I am having trouble checking a directory for all files of a certain filetype in python, .wav to be specific. I have tried a few different methods to solve the problem but can't seem to tackle it. Is there any way in python to check a directory like this?