Created
July 7, 2020 18:08
-
-
Save L04DB4L4NC3R/027c97d71a2a804d99d4e5b2023e6d08 to your computer and use it in GitHub Desktop.
Tree command output to markdown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#File: tree-md | |
tree=$(tree -tf --noreport -I '*~' --charset ascii $1 | | |
sed -e 's/| \+/ /g' -e 's/[|`]-\+/ */g' -e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g') | |
printf "# Project tree\n\n${tree}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for providing this!! I updated my version to include a -d (directories only) and -L 4 (to go 4 levels deep).