Get dirs and files for paths

This commit is contained in:
Mauricio Baeza 2020-11-20 23:44:16 -06:00
parent d40371752b
commit fc6e6ee93e
1 changed files with 10 additions and 0 deletions

View File

@ -4524,6 +4524,16 @@ class Paths(object):
return result
@classmethod
def files(cls, path, pattern='*'):
files = [str(p) for p in Path(path).glob(pattern) if p.is_file()]
return files
@classmethod
def dirs(cls, path):
dirs = [str(p) for p in Path(path).iterdir() if p.is_dir()]
return dirs
@classmethod
def walk(cls, path, filters=''):
paths = []