Patrick Lewery Harris

Forest - A file tree utility

By Patrick Harris

License standard-readme compliant


Forest is a small program used for viewing and searching the file tree. It is heavily inspired by the tree command and one of my assignments for CSC209 at UofT.


$ git clone
$ cd forest
$ make



To print the file tree for a specific directory use:

$./print_forest DIRECTORY

Where DIRECTORY is the relative path


Running search_forest will search the file tree for items that match your search criteria. Searches can be done by name, permissions, type or regex. Regex searches are a more sophisticated version of the name search.


Where MODE is the search mode you want to use, DIRECTORY is the relative path and OCCURRENCES is the maximum number of results you want displayed. Use ALL if you want all results.

Only one of FILENAME, PERMS or FILETYPE may be included, corresponding to the search mode.

Input FILENAME if searching by name or regex, PERMS if searching by perms and FILETYPE if searching by type.

Search modes:

#define NAME 0
#define PERM 1
#define TYPE 2
#define REGEX 3

Type Codes:

#define REGFILE 0
#define REGDIR 1


./search_forest NAME . forest.c ALL

This search searches for files with the file name “forest.c” in the current directory

./search_forest PERM . 420 ALL

This search searches for files with permissions code 420 in the current directory

./search_forest TYPE . DIR ALL

This search searches for directories in the current directory

./search_forest REGEX  . forest ALL

This searches using regex ‘forest’, returning all items that contain ‘forest’ in the current directory


PRs accepted.

Small note: If editing the Readme, please conform to the standard-readme specification.