https://github.com/teomandeniz/tree_unix
A replica of "tree" command from Microsoft Windows for Unix
https://github.com/teomandeniz/tree_unix
c linux macos unix
Last synced: 3 months ago
JSON representation
A replica of "tree" command from Microsoft Windows for Unix
- Host: GitHub
- URL: https://github.com/teomandeniz/tree_unix
- Owner: TeomanDeniz
- License: gpl-3.0
- Created: 2024-02-11T15:33:00.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-15T23:58:41.000Z (over 2 years ago)
- Last Synced: 2025-04-13T13:49:17.329Z (about 1 year ago)
- Topics: c, linux, macos, unix
- Language: C
- Homepage: https://maximum-tension.com
- Size: 33.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Unix Tree
This project is a Unix command-line tool written in C language, inspired by the functionality of the "tree" command in Windows. It provides a visual representation of the directory structure starting from the current directory or a specified directory.
## Usage
### Display Directory Tree
To display the directory tree of the current directory:
```bash
./tree
```
To display the directory tree of a specific folder:
```bash
./tree ./test_folder
./tree test_folder
```
### Display All Files
To include all files, including hidden files (such as .git, .DS_STORE), use the -a or -A option:
```bash
./tree -a
```
You can combine the options with directory paths:
```bash
./tree -a test_folder
./tree test_folder -a
```
You can also edit the output by the defines inside of the `header.h` if you want:
```c
# define TREE_START ".\n" /* ./tree.c */
# define TREE_DRAW_BRANCH ":.." /* ./recursive_tree.c */
# define TREE_PRINT_FILE " %s\n" /* ./recursive_tree.c */
# define TREE_PRINT_FOLDER "[%s]\n" /* ./recursive_tree.c */
# define TREE_DRAW_LINE ": " /* ./recursive_tree.c */
# define TREE_DRAW_IDLE " " /* ./recursive_tree.c */
```
## Example Output:
```
.
:.. LICENSE
:.. main.c
:.. Makefile
:.. path_overwrite.c
:.. path_overwrite.o
:.. recursive_tree.c
:.. recursive_tree.o
:.. tree
:.. tree.a
:.. tree.c
:..[tree.dSYM]
: :..[Contents]
: :.. Info.plist
: :..[Resources]
: :..[DWARF]
: :.. tree
:
:.. tree.h
:.. tree.o
```
```
.
:..[.git]
: :.. config
: :.. description
: :.. HEAD
: :..[hooks]
: : :.. applypatch-msg.sample
: : :.. commit-msg.sample
: : :.. fsmonitor-watchman.sample
: : :.. post-update.sample
: : :.. pre-applypatch.sample
: : :.. pre-commit.sample
: : :.. pre-merge-commit.sample
: : :.. pre-push.sample
: : :.. pre-rebase.sample
: : :.. pre-receive.sample
: : :.. prepare-commit-msg.sample
: : :.. update.sample
: :
: :.. index
: :..[info]
: : :.. exclude
: :
: :..[logs]
: : :.. HEAD
: : :..[refs]
: : :..[heads]
: : : :.. main
: : :
: : :..[remotes]
: : :..[origin]
: : :.. HEAD
: :
: :..[objects]
: : :..[19]
: : : :.. 0e20f699268b886048a1f38406c8075f756887
: : :
: : :..[50]
: : : :.. 08ddfcf53c02e82d7eee2e57c38e5672ef89f6
: : :
: : :..[6e]
: : : :.. fe821b3e0ce42c41dc79cc3904769512fa2a61
: : :
: : :..[76]
: : : :.. fb25c9e4ca990d3361801dfbc86520273f9c12
: : :
: : :..[79]
: : : :.. 97a09412ad291ae9e6a0ffea586e7445961133
: : :
: : :..[ea]
: : : :.. 3d270a7580832ac9b6d674c5575ca3ae853779
: : :
: : :..[fb]
: : : :.. 77738811439a8d8d529bb693b7ee0abfc2fbb0
: : :
: : :..[info]
: : :
: : :..[pack]
: : :.. pack-326d33b51e7d0acd97b6b436117a4bbd05967c18.idx
: : :.. pack-326d33b51e7d0acd97b6b436117a4bbd05967c18.pack
: :
: :.. packed-refs
: :..[refs]
: :..[heads]
: : :.. main
: :
: :..[remotes]
: : :..[origin]
: : :.. HEAD
: :
: :..[tags]
:
:..[asd]
:
:.. Another test file
```