1import os
2#full path
3dir_path = os.path.dirname(os.path.realpath(__file__))
4
5#current dir
6cwd = os.getcwd()
7
1import os
2
3def listdir_r(dirpath):
4 """lists directories and sub-directories recursively.
5 """
6 paths=[]
7 paths.append(dirpath)
8 for path in os.listdir(dirpath):
9 rpath = os.path.join(dirpath, path)
10 if os.path.isdir(rpath):
11 subdirs = listdir_r(rpath)
12 if not subdirs == []:
13 paths.extend(subdirs)
14 return paths
15
16# print the list of sub-directories
17print(listdir_r('./'))