Last active
November 11, 2016 17:09
-
-
Save hackingbutlegal/3dc8e224b219b4642e4b020ceaffa577 to your computer and use it in GitHub Desktop.
Generate html file from a directory of files. Usage: ./dir2html.sh [path to dir] > index.html
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 | |
# usage: dir2html.sh [dir] > index.html | |
INDEX=`ls -1 $1 | sed "s/^.*/ <li\>\<a\ href=\"&\"\>&\<\\/a\>\<\\/li\>/"` | |
echo "<html> | |
<head><title>Index of $1</title></head> | |
<body> | |
<h2>Index of $1</h2> | |
<hr> | |
<ui> | |
$INDEX | |
<ui> | |
</body> | |
</html>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment