download-files.sh
470 Bytes
#!/bin/sh
set -ex
had_error=0
if [ $# -eq 0 ]; then
had_error=$(($had_error + 1))
echo "No files to download!" 1>&2
fi
if [ "z$DOWNLOAD_OUTPUT" = z ]; then
had_error=$(($had_error + 1))
echo "DOWNLOAD_OUTPUT variable not set!" 1>&2
fi
if [ $had_error -gt 0 ]; then
exit 1
fi
echo "Downloading files: $@"
echo " placing them in: $DOWNLOAD_OUTPUT"
for item in "$@"; do
target="${item%%:*}"
source="${item#*:}"
/s5cmd cp "$source" "$DOWNLOAD_OUTPUT/$target"
done