Today we are going to share a Python program to find all mp3 files. If you are a python beginner and want to start learning the python programming, then keep your close attention in this tutorial as I am going to share a how to find all mp3 files in your computer.
To increase your Python knowledge, practice all Python programs, here is a collection of 100+ Python problems with solutions.
Copy the below python program and execute it with the help of python compiler.
rootPath = '/'
pattern = '*.mp3'
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
print( os.path.join(root, filename))