forked from oupala/apaxy
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhtml-tree
More file actions
executable file
·23 lines (18 loc) · 774 Bytes
/
html-tree
File metadata and controls
executable file
·23 lines (18 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# This script produces a static HTML directory listing from the current folder
CURRENT_FOLDER_PATH="$(pwd)"
CURRENT_FOLDER_NAME="${CURRENT_FOLDER_PATH##*/}"
TREE_FOLDER="$CURRENT_FOLDER_NAME-tree"
# https://stackoverflow.com/a/78726693/1657502
# https://stackoverflow.com/a/66052975/1657502
docker run --name temp_server --rm -d -v "$CURRENT_FOLDER_PATH:/usr/local/apache2/htdocs/" -p 8080:8080 antoniomedeiros/apaxy:latest >/dev/null 2>&1
cd ..
# https://askubuntu.com/a/720334/560233
wget -q -r --no-parent --reject '*?C=*' http://localhost:8080/
mv localhost:8080 $TREE_FOLDER
rm -rf localhost:8080
# https://askubuntu.com/a/269818/560233
rsync -a $TREE_FOLDER/ $CURRENT_FOLDER_NAME/
# Clean up
rm -rf $TREE_FOLDER
docker stop temp_server >/dev/null 2>&1