Created
January 25, 2017 22:05
-
-
Save esell/9985b710afff9759f2bbb8622fcb9938 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
# jq is needed for this to work: https://stedolan.github.io/jq/ | |
# full blob path to copy including SAS key | |
fromURL="https://stgacct.blob.core.windows.net/containername/filename?sv=YOUR_SAS_KEY" | |
# destination storage acct name | |
toAcctName="toStgAcct" | |
# destination storage acct SAS key | |
toAcctSAS="TO_SAS_KEY" | |
# destination filename | |
toFileName="toFilename" | |
# destination storage acct container name | |
toContainer="toContainerName" | |
echo "starting copy..." | |
az storage blob copy start -u "$fromURL" --account-name "$toAcctName" --sas-token "$toAcctSAS" -b "$toFileName" -c "$toContainer" | |
echo "copy submitted" | |
echo "" | |
echo "start time: `date -R`" | |
echo "" | |
echo "starting status check..." | |
statuscheck="null" | |
while [ "$statuscheck" == "null" ] | |
do | |
statuscheck=`az storage blob show --account-name "$toAcctName" --sas-token "$toAcctSAS" -c "$toContainer" -n "$toFileName" | jq '. | .properties.copy.completionTime'` | |
echo "statuscheck is $statuscheck" | |
sleep 1 | |
done | |
echo "" | |
echo "end time: `date -R`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment