2019-03-08

GitHub download file from Private Repository

#!/bin/bash
#/opt/script/github-download-file.sh
#LastUpdate: #14:53 2019.03.08
#######################################
#__________GitHub_Global_Variable:BEGIN
TOKEN=""
USER_NAME=""
REPO_NAME=""
BRANCHE_NAME="master"

FILE_NAME="openssl-1.1.0h-portable-OPT-20180716-1.7z"
FILE_URL="https://raw.githubusercontent.com/$USER_NAME/$REPO_NAME/$BRANCHE_NAME/$FILE_NAME"
#__________GitHub_Global_Variable:END


#__________Deploy:BEGIN
cd /opt/setup;
curl -H "Authorization: token $TOKEN" $FILE_URL -o $FILE_NAME
#UNCOMPRESS $FILE_NAME
#__________Deploy:END


#THE-END


#REF:
#1/ Download a file:
#curl -H "Authorization: token $TOKEN" $FILE_URL -o $FILE_NAME

#2/ Download a directory:
#wget --no-parent -r h t t p://domain.abc/DIRECTORY

#3/ h ttps://stackoverflow.com/questions/11783280/downloading-all-the-files-in-a-directory-with-curl
If you're not bound to curl, you might want to use wget in recursive mode but restricting it to one level of recursion, try the following:
wget --no-verbose --no-parent --recursive --level=1\ --no-directories --user=login --password=pass ftp://ftp.myftpsite.com/
--no-parent : Do not ever ascend to the parent directory when retrieving recursively. 
--level=depth : Specify recursion maximum depth level depth. The default maximum depth is five layers. 
--no-directories : Do not create a hierarchy of directories when retrieving recursively.
#

No comments:

Post a Comment