Skip to content

Commit d9ec71d

Browse files
committed
Allow the use of wildcards in the local path string
Signed-off-by: Kostis Papazafeiropoulos <[email protected]>
1 parent 37c5dfc commit d9ec71d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

entrypoint.sh

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ die() {
2121

2222
ok_or_die() {
2323
if [ $? -ne 0 ]; then
24-
die $1
24+
die "$1"
2525
fi
2626
}
2727

@@ -37,18 +37,22 @@ remote_path=$5
3737

3838
info "Will upload $local_path to $remote_path"
3939

40-
mc alias set s3 $url $access_key $secret_key
40+
mc alias set s3 "$url" "$access_key" "$secret_key"
4141
ok_or_die "Could not set mc alias"
4242

43-
mc cp -r $local_path s3/$remote_path
43+
IFS=$'\n'
44+
for p in $(eval ls -d -1 "$local_path"); do
45+
mc cp -r "$p" s3/"$remote_path";
46+
done
47+
unset IFS
4448
ok_or_die "Could not upload object"
4549

4650
if [[ $# -eq 6 ]] ; then
4751
if [[ $6 -eq 1 ]] ; then
4852
info "Will make $remote_path public"
49-
mc anonymous -r set download s3/$remote_path
53+
mc anonymous -r set download s3/"$remote_path"
5054
else
5155
info "Will make $remote_path private"
52-
mc anonymous -r set private s3/$remote_path || true
56+
mc anonymous -r set private s3/"$remote_path" || true
5357
fi
5458
fi

0 commit comments

Comments
 (0)