Skip to content

Instantly share code, notes, and snippets.

@praveenc
Created May 21, 2020 17:57
Show Gist options
  • Save praveenc/8b5213fd537d4e9e252dd37cecc25c65 to your computer and use it in GitHub Desktop.
Save praveenc/8b5213fd537d4e9e252dd37cecc25c65 to your computer and use it in GitHub Desktop.
Get all filenames (fqdn) under a given directory
#!/usr/bin/env python
from os import walk
from os.path import join
DIR_PATH='/path/to/dir'
## Get all pdf files under the dir DIR_PATH
for (dirpath, _, filenames) in walk(DIR_PATH):
full_names = [join(dirpath, fn) for fn in filenames if fn.endswith('pdf')]
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment