Skip to content

Instantly share code, notes, and snippets.

@khajer
Created January 4, 2024 05:06
Show Gist options
  • Select an option

  • Save khajer/824d4e148a6e82d5a7da79967964cba9 to your computer and use it in GitHub Desktop.

Select an option

Save khajer/824d4e148a6e82d5a7da79967964cba9 to your computer and use it in GitHub Desktop.
recursive-show -file-folder.py
import os
def listfilepath(space, path):
lst = os.listdir(path)
for f in lst:
if os.path.isdir(path+"/"+f):
print(space, "[folder]:", f)
listfilepath(space+" ", path+"/"+f)
else:
print(space, "file:", f)
def main():
path = "/Users/itsara/sourcecode/saksiam/sak-gitops"
listfilepath("", path)
if __name__ == "__main__":
main()%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment