uploader with progress bar. reown log file
This commit is contained in:
@@ -3,18 +3,15 @@ test -n "$1" || {
|
||||
echo "Add files to upload as argument"
|
||||
exit 1
|
||||
}
|
||||
CAT=$( which cat )
|
||||
which pv &> /dev/null && CAT=$( which pv )
|
||||
ROOTURL="{{ rooturl }}"
|
||||
SHARE="{{ name }}"
|
||||
TOKEN="{{ token }}"
|
||||
|
||||
send_file() {
|
||||
$CAT "$file_name" | curl -F "file=@-;filename=${base_name}" "${ROOTURL}upload/${SHARE}/${TOKEN}"
|
||||
cat "$file_name" | curl --progress-bar -F "file=@-;filename=${base_name}" "${ROOTURL}upload/${SHARE}/${TOKEN}" | cat -
|
||||
}
|
||||
send_folder() {
|
||||
which pv &> /dev/null && printf -v dusize -- "--size %dk" $( du -s -k "$file_name" | cut -f1 )
|
||||
tar cz "$file_name" | $CAT $dusize - | curl -F "file=@-;filename=${base_name}.tgz" ${ROOTURL}upload/${SHARE}/${TOKEN}
|
||||
tar cz "$file_name" | curl --progress-bar -F "file=@-;filename=${base_name}.tgz" "${ROOTURL}upload/${SHARE}/${TOKEN}" | cat -
|
||||
}
|
||||
|
||||
for file_name in "$@"; do
|
||||
|
||||
Reference in New Issue
Block a user