Created
May 21, 2020 17:57
-
-
Save praveenc/8b5213fd537d4e9e252dd37cecc25c65 to your computer and use it in GitHub Desktop.
Get all filenames (fqdn) under a given directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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