DirTracer is a command-line utility written in Go that generates a visual representation of a directory tree. It allows users to easily view the structure of their directories and customize the output according to their preferences.
- Generates a tree-like structure of directories and files.
- Includes options to include or exclude files from the output.
- Works on Windows, Linux, and macOS.
- Ensure you have Go installed on your machine.
- A terminal or command prompt for running commands.
-
Clone the Repository:
git clone https://github.com/simplyYan/DirTracer.git cd DirTracer -
Build the Executable:
Choose the appropriate command based on your operating system:
For Windows:
GOOS=windows GOARCH=amd64 go build -o DirTracer.exe
For Linux:
GOOS=linux GOARCH=amd64 go build -o DirTracer
For macOS:
GOOS=darwin GOARCH=amd64 go build -o DirTracer
-
Add to PATH (Optional):
To make the
DirTracercommand accessible from anywhere in your terminal, move the executable to a directory that is included in yourPATH. For example:-
Linux/macOS:
mv DirTracer /usr/local/bin/
-
Windows: Move
DirTracer.exeto a directory listed in yourPATH, or add the directory containingDirTracer.exeto your systemPATH.
-
To use DirTracer, open your terminal and run the following command:
./DirTracer -dir "/path/to/your_directory" -files true-
-dir: Specify the directory to trace. The default is the current directory (.). -
-files: Include files in the output. The default istrue. Set tofalseto exclude files from the output.
./DirTracer -dir "/home/user/Documents" -files trueThis command will display the directory structure of Documents, including all files.
The output will be structured in a tree format, similar to:
/my_directory
├── documents
│ ├── letter.txt
│ ├── resume.pdf
│ └── grades/
│ ├── grade1.txt
│ └── grade2.txt
├── images
│ ├── photo1.jpg
│ ├── photo2.png
│ └── wallpapers/
│ ├── wallpaper1.jpg
│ └── wallpaper2.png
└── music
├── song1.mp3
├── song2.mp3
└── playlists/
├── playlist1.m3u
└── playlist2.m3u
Contributions are welcome! If you have suggestions or improvements, feel free to submit a pull request or open an issue.
This project is licensed under the MIT License. See the LICENSE file for details.
- Thanks to the Go community for providing excellent documentation and support.
For any questions or feedback, please reach out to [your-email@example.com].