Last active
July 19, 2024 14:41
-
-
Save tomkinsc/540abeb4d69f22f010a765274dbbdd6c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -eq 0 ]; then | |
echo "This script can be used to transfer all files from a BaseSpace project " | |
echo "Usage: $0 BaseSpaceProjectName" | |
echo " Before running, be sure to log in to BaseSpace" | |
echo " bs auth" | |
echo " The CLI toolkits for bs can be found here and must be installed first:" | |
echo " https://developer.basespace.illumina.com/docs/content/documentation/cli/cli-overview" | |
exit 1 | |
fi | |
bsproject="$1" | |
for fileinfo in $(bs contents run --name "$bsproject" --template='{{.Id}},{{.FilePath}}'); do | |
fileid=$(echo "$fileinfo" | cut -d, -f1) | |
filename=$(echo "$fileinfo" | cut -d, -f2) | |
echo "Starting job to transfer file: $filename" | |
bslink=$(bs file link --id "$fileid") | |
containing_dir=$(dirname "${filename}") | |
mkdir -p "${containing_dir}" | |
wget $bslink -O $filename | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment