This is a learning project from the One2N Go Bootcamp. It's a simple program that shows folders and files in a tree-like structure, similar to the tree command in Unix.
This program can:
- Show all your files and folders in a nice tree structure
- Show the full path of each file if you want
- Show file permissions
- Show only folders (skip files)
- Let you choose how deep to show the folder structure
- Count how many files and folders it found
First, make sure you have Go installed on your computer. Then:
- Get the code:
git clone https://github.com/yourusername/Tree-exercise.git- Go to the project folder:
cd Tree-exercise- Build the program:
# This will create the binary in the project root directory
go build -o ./tree ./tree/Here are some basic commands you can try:
# Show files and folders in current directory
./tree
# Show full paths
./tree --relative-path
# Show permissions
./tree --permission
# Show only folders
./tree --directory-only
# Only show folders up to a certain depth
./tree --level 2 # This will show only 2 levels deepThis project is built with:
- The Cobra package to handle commands
- Basic Go file operations
To run the tests:
go test ./...Check the LICENSE file for license details.