# ๐Ÿ—‚๏ธ tree โ€“ Directory Tree Viewer in C A simplified implementation of the Unix `tree` command in C. This utility recursively traverses a directory and prints its structure in a tree-like format. --- ## ๐Ÿ“ฆ Project Structure ``` tree/ โ”œโ”€โ”€ main.c # Entry point โ”œโ”€โ”€ tree.c # Directory traversal logic โ”œโ”€โ”€ tree.h # Function declarations โ”œโ”€โ”€ Makefile # Build & test automation โ””โ”€โ”€ test/ โ””โ”€โ”€ run_tests.sh # Automated tests + Valgrind ``` --- ## โš™๏ธ Build Instructions To compile the program: ```bash make ``` To clean up build files: ```bash make clean ``` To remove test artifacts as well: ```bash make distclean ``` --- ## ๐Ÿงช Running Tests The test script: - Creates a temporary directory structure - Runs the program and compares its output to the expected result - Performs memory leak analysis with **Valgrind** To run all tests: ```bash make test ``` --- ## ๐Ÿš€ Usage ```bash ./tree [DIRECTORY] ``` If no directory is specified, the current directory (`.`) is used. Example: ```bash ./tree testdir ``` Sample output: ``` |-- file1.txt |-- sub1 |-- file2.txt |-- sub2 |-- file3.txt ``` --- ## ๐Ÿง  Learning Objectives - Use of `opendir`, `readdir`, and `closedir` to iterate directories - Handling file paths and recursion - Working with `stat` to detect subdirectories - Implementing simple CLI programs in C - Using `Makefile` and Valgrind for tooling and quality --- ## โœ… Requirements - GCC (C11) - POSIX-compliant system (Linux, macOS) - [Valgrind](https://valgrind.org/) for memory checking (optional, used in tests) --- ## ๐Ÿ“„ License Educational use only. No license required.