Skip to content

Instantly share code, notes, and snippets.

@bombs-kim
Last active January 16, 2019 05:32
Show Gist options
  • Save bombs-kim/67894a6831cc32bf86d54ec3617c184d to your computer and use it in GitHub Desktop.
Save bombs-kim/67894a6831cc32bf86d54ec3617c184d to your computer and use it in GitHub Desktop.
paths_utils.py
import os
from os.path import abspath, exists, join, isdir, basename, dirname
def list_abs(root, files=True, dirs=False):
for path in os.listdir(root):
path = abspath(join(root, path))
if isdir(path):
if dirs: yield path
yield from list_abs(path)
else:
if files: yield path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment