Skip to content

Instantly share code, notes, and snippets.

@kflorence
kflorence / markdown-toc-tree.sh
Last active April 26, 2024 20:30
Creates a markdown table of contents from a file tree (omitting the directory itself, "readme.md" files and "images" folders and their contents)
#!/usr/bin/env bash
# This script generates markdown from the output of the `tree` command.
# See: https://linux.die.net/man/1/tree
# See: https://gist.github.com/kflorence/7f18ad97c65337ef77d37159260a331d
set -e
# Tree is configured with:
# - `-f`: use full paths in output (relative to directory given, in this case '.').
# - `--noreport`: exclude the directories and files report as the last line of output.