Last active
January 7, 2021 15:03
-
-
Save filesmuggler/7fbb66e01a52523665ecabd30b65b0d1 to your computer and use it in GitHub Desktop.
Download chosen directory from git repository instead of cloning whole repo
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 | |
: ' | |
Downloads data from given github folder | |
Autor: Krzysztof Stezala <krzysztof.stezala at student.put.poznan.pl> | |
Version: 0.1 | |
License: MIT | |
Example use: | |
bash download_dir_from_github.sh https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series | |
' | |
REPO_LINK=$1 | |
DIR="data" | |
TRUNK="trunk" | |
if [ -d "$DIR" ]; then | |
# Take action if $DIR exists. # | |
echo "Directory ${DIR} exists." | |
echo "Updating ${DIR} directory.." | |
svn export --force "${REPO_LINK/"tree/master"/$TRUNK}" ${DIR} | |
else | |
echo "Creating ${DIR} directory..." | |
mkdir data | |
echo "Copying data to ${DIR} directory.." | |
svn export --force "${REPO_LINK/"tree/master"/$TRUNK}" ${DIR} | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example use:
bash download_dir_from_github.sh https://github.com/CSSEGISandData/COVID-19/tree/master/csse_covid_19_data/csse_covid_19_time_series