Created
January 4, 2024 05:06
-
-
Save khajer/824d4e148a6e82d5a7da79967964cba9 to your computer and use it in GitHub Desktop.
recursive-show -file-folder.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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