So I\'m creating a GitHub Pages site to list all of the Gifs in my jglovier/gifs repo. GH Pages runs only static HTML/CSS/JS or Jekyll, so I cannot use an apache directory listi
#!/bin/bash
ROOT=/tmp/test
HTTP="/"
OUTPUT="_includes/site-index.html"
i=0
echo "" > $OUTPUT
for filepath in `find "$ROOT" -maxdepth 1 -mindepth 1 -type d| sort`; do
path=`basename "$filepath"`
echo " - $path
" >> $OUTPUT
echo " " >> $OUTPUT
for i in `find "$filepath" -maxdepth 1 -mindepth 1 -type f| sort`; do
file=`basename "$i"`
echo " - $file
" >> $OUTPUT
done
echo "
" >> $OUTPUT
done
echo "
" >> $OUTPUT
My /tmp/test
/tmp/test
├── accidents
│ ├── accident2.gif
│ ├── accident3.gif
│ └── accident4.gif
├── bears
│ ├── bears1.gif
│ ├── bears2.gif
│ ├── bears3.gif
│ └── bears4.gif
└── cats
├── cats1.gif
└── cats2.gif
The resulting output
- accidents
- bears
- cats
You could expand the UL with href too, but I wasn't sure if that's what you wanted.
echo " $path" >> $OUTPUT
You would have to run this in the parent folder of _includes