Skip to content

Instantly share code, notes, and snippets.

@muammar
Created August 2, 2016 22:21
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 muammar/6444f3c269280ca12d243cd49488d9a7 to your computer and use it in GitHub Desktop.
Save muammar/6444f3c269280ca12d243cd49488d9a7 to your computer and use it in GitHub Desktop.
dirlist.sh
for DIR in $(find ./ -type d); do
(
echo "<html>\n<body>\n<h1>Directory listing</h1>\n<hr/>\n<pre>"
ls -1pa "${DIR}" | grep -v "^\./$" | grep -v "^index\.html$" | awk '{ printf "<a href=\"%s\">%s</a>\n",$1,$1 }'
echo "</pre>\n</body>\n</html>"
) > "${DIR}/index.html"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment