#!/usr/bin/python3 import os def tree_print(file): if os.path.isfile(file): print(file) else: print(file, '/', sep='') file_list = os.listdir(file) for f in file_list: filename_and_path = file + '/' + f tree_print(filename_and_path) tree_print('.') #file_list = os.listdir()