Skip to content

Commit 1519c3a

Browse files
committed
Allow up to 50 files to be downloaded from cloudsmith
1 parent 55298ff commit 1519c3a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

download_xml_bash.sh

+11-6
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ if [ "$#" -ne "4" ]; then
1414
exit
1515
fi
1616

17-
REPO="https://cloudsmith.io/~$3/repos/"
18-
echo "Issuing command: wget -q -O - $REPO$1-$4/packages/?q=*$2*.xml"
17+
NAME="$1"
18+
VERSION="$2"
19+
USER="$3"
20+
LEVEL="$4"
21+
22+
REPO="https://cloudsmith.io/~${USER}/repos/"
23+
echo "Issuing command: wget -q -O - $REPO${NAME}-${LEVEL}/packages/?q=*${VERSION}*.xml"
1924
my_array=()
2025
echo "Show current files that match criteria"
21-
ls metadata/$1*-$2*xml -la
26+
ls metadata/${NAME}*-*${VERSION}*xml -la
2227
echo "Deleting current files that match criteria"
23-
rm metadata/$1*-$2*xml
28+
rm metadata/${NAME}*-*${VERSION}*xml
2429
echo "Finding files on remote cloudsmith repository"
2530
delimiter="href=\""
2631
delimiter1=".xml\" title"
@@ -35,7 +40,7 @@ while read -r line; do
3540
my_array+=( $line );
3641
echo "found: $line"
3742
fi
38-
done < <(wget -q -O - "$REPO$1-$4/packages/?q=*$2*xml")
43+
done < <(wget -q -O - "$REPO${NAME}-${LEVEL}/packages/?q=*${VERSION}*xml+tag:latest&page_size=50")
3944

4045
echo "Downloading files found that match criteria"
4146
for URL in "${my_array[@]}"
@@ -44,5 +49,5 @@ do
4449
wget --progress=bar:force:noscroll -c $URL -P metadata
4550
done
4651
echo "Files downloaded"
47-
ls -l metadata/$1*-$2*xml
52+
ls -la metadata/${NAME}*-*${VERSION}*xml
4853

0 commit comments

Comments
 (0)