Skip to content

Instantly share code, notes, and snippets.

@mburakerman
Created October 30, 2020 08:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mburakerman/41a8af6e9f6f9292b9bf433eae97d721 to your computer and use it in GitHub Desktop.
Save mburakerman/41a8af6e9f6f9292b9bf433eae97d721 to your computer and use it in GitHub Desktop.
find a specific file using python
import os
import fnmatch
rootPath = '/'
pattern = '*.mp3'
for root, dirs, files in os.walk(rootPath):
for filename in fnmatch.filter(files, pattern):
print(os.path.join(root, filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment