mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-31 10:20:58 +00:00
docs: add new upload scripts
This commit is contained in:
parent
4651e1ae77
commit
347a78e2e7
21
docs/manual/mirror_file_sftp.sh
Executable file
21
docs/manual/mirror_file_sftp.sh
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
USAGE="Usage: mirror_file_sftp.sh user@host local_path remote_path"
|
||||||
|
|
||||||
|
# command line checks, bash
|
||||||
|
if [ $# -ne 3 ]; then
|
||||||
|
echo ${USAGE}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
user_host=$1
|
||||||
|
local_path=$2
|
||||||
|
remote_path=$3
|
||||||
|
|
||||||
|
echo Mirroring file ${local_path} to ${user_host}:${remote_path}
|
||||||
|
|
||||||
|
# SFTP is very peculiar: recursive put only works for a single directory
|
||||||
|
# note: does not work with sftp of OS X 10.11
|
||||||
|
sftp ${user_host} << EOF
|
||||||
|
put ${local_path} ${remote_path}
|
||||||
|
quit
|
||||||
|
EOF
|
||||||
|
rm -rf tmp/${folder}
|
27
docs/manual/mirror_folder_sftp.sh
Executable file
27
docs/manual/mirror_folder_sftp.sh
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
USAGE="Usage: mirror_folder_sftp.sh user@host local_path remote_path"
|
||||||
|
|
||||||
|
# command line checks, bash
|
||||||
|
if [ $# -ne 3 ]; then
|
||||||
|
echo ${USAGE}
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
user_host=$1
|
||||||
|
local_path=$2
|
||||||
|
remote_path=$3
|
||||||
|
|
||||||
|
echo Mirroring folder ${local_path} to ${user_host}:${remote_path}
|
||||||
|
|
||||||
|
# SFTP is very peculiar: recursive put only works for a single directory
|
||||||
|
# note: does not work with sftp of OS X 10.11
|
||||||
|
folder=`basename ${remote_path}`
|
||||||
|
path=`dirname ${remote_path}`
|
||||||
|
rm -rf tmp
|
||||||
|
mkdir tmp
|
||||||
|
cp -r ${local_path} tmp/${folder}
|
||||||
|
sftp ${user_host} << EOF
|
||||||
|
mkdir ${remote_path}
|
||||||
|
put -r tmp/${folder} ${path}
|
||||||
|
quit
|
||||||
|
EOF
|
||||||
|
rm -rf tmp/${folder}
|
Loading…
x
Reference in New Issue
Block a user