-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhtml-tree
More file actions
executable file
·24 lines (19 loc) · 857 Bytes
/
html-tree
File metadata and controls
executable file
·24 lines (19 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/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/repo/" -p 8080:8080 antoniomedeiros/apaxy:latest >/dev/null 2>&1
# TODO Remove hard-coded "repo"
cd ..
# https://askubuntu.com/a/720334/560233
wget -q -r --no-parent --reject '*.db,*.files,*.tar.gz*,*pkg.tar.zst,*?C=*' http://localhost:8080/repo/
mv localhost:8080/repo $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