Skip to content

Instantly share code, notes, and snippets.

@iamaziz
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamaziz/45688ef2767d33d4bd50 to your computer and use it in GitHub Desktop.
Save iamaziz/45688ef2767d33d4bd50 to your computer and use it in GitHub Desktop.
Script to create an html page as a tree of current directory, based on tree: http://mama.indstate.edu/users/ice/tree/
#!/bin/bash
# create a tree of current directory in an html page `readme.html`
# to use it: place treeme.sh somewhere and add it your path
# (add/remove any extension to EXECLUDE to be displayed/execluded)
TITLE="Tree of:"
PWD=$(pwd)
OUTPUT="readme.html"
if [[ -n "$1" ]]; then # if output file name is provided
OUTPUT="$1";
fi
EXECLUDE="readme.html|*.class|*.gif|*.jar|*.png|*.ipynb|*.csv|*.RData|*.pyc|*.ico|*.svg|*.ttf|*.eot|*.woff|*.dll|*.nupkg|"
tree -H . -T "$TITLE $PWD" -C --dirsfirst -o "$OUTPUT" -I "$EXECLUDE" --filelimit 40
printf "Treed the folder: $PWD\nEnjoy browsing it in $OUTPUT";
open "$OUTPUT";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment