Created
April 7, 2015 11:52
-
-
Save humanium/670450ca54a246925bb2 to your computer and use it in GitHub Desktop.
Get all files paths in direstory recursively
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
def get_all_file_paths(root_path): | |
paths = [] | |
for item in os.listdir(root_path): | |
full_path = os.path.join(root_path, item) | |
if os.path.isfile(full_path): | |
paths.append(full_path) | |
else: | |
paths.extend(get_all_file_paths(full_path)) | |
return paths |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment