blob: e15dc121536de404c3e7619c1029faf5edbc4fca (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#!/usr/bin/env bash
set -euo pipefail
BASE_URL="$1"
TOKEN="$2"
BASE_PATH="$3"
list_path_rec() {
path="$1"
result=$(curl -ks "$BASE_URL/storage/$path?authtoken=$TOKEN")
case "$(echo "$result" | jq -r .type)" in
"file") echo "$result" | jq -r .path | sed -e "s@^$BASE_PATH/@@"
;;
"directory")
echo "$result" | jq -r ".resources[]|.path" | while read p; do list_path_rec "$p"; done
;;
esac
}
list_path_rec "$BASE_PATH"
|