qtree is a command-line tool for traversing and displaying directory structures. It provides output in multiple formats including plain text, JSON, and XML. Designed for flexibility, it can be easily integrated into various workflows to visualize directory hierarchies.
- Directory Traversal: Recursively traverses directories and lists their contents.
- Output Formats: Supports output in plain text, JSON, and XML formats.
- Customizable Output: Allows specification of output files and format via command-line arguments.
- Error Handling: Provides informative error messages for common issues like file access errors.
Ensure you have the following installed:
- CMake 3.10 or later
- A C compiler like
clang
-
Clone the Repository:
git clone https://github.com/quecot/qtree.git cd qtree -
Build the Project:
mkdir build cd build cmake .. make -
Install (Optional):
sudo make install
The qtree program is executed from the command line and provides various options for its operation. Below is a summary of the available options:
Usage: qtree [options] <directory>
Options:
-j, --json Output as JSON
-x, --xml Output as XML
-h, --help Show this help message
-v, --version Show version information
-o, --output Specify output fileWhere:
<directory>: The path to the directory to be traversed.-j, --json: Output the directory structure in JSON format.-x, --xml: Output the directory structure in XML format.-h, --help: Display the help message and exit.-v, --version: Display version information and exit.-o, --output <file>: Write the output to the specified file instead of the defaultstdout.
qtree -j -o output.json /path/to/directoryThis command will traverse /path/to/directory and output the directory structure in JSON format to output.json.
Follow the Build Instructions to compile the project. The source code is organized with the main logic in src/main.c.
The project uses CMake for build configuration. The CMakeLists.txt file is configured to use clang as the compiler and clang-tidy for code quality checks. The build type defaults to Release.
This project is licensed under the MIT License. See the LICENSE file for more details.