使用命令行上传文件到共享网站file.io
在~/.bashrc
最后添加下面脚本
upload () { if [ $# = 1 -o $# = 2 ];then if [ -f "$1" ];then if [ $# = 1 ];then curl -F "file=@$1" https://file.io/ --no-progress-meter | grep -Eo "http|https://[a-zA-Z0-9./?=_%:-]*";else if [[ "$2" =~ ^[1-9]+[wmy]$ ]];then curl -F "file=@$1" https://file.io/\?expires=$2 --no-progress-meter | grep -Eo "http|https://[a-zA-Z0-9./?=_%:-]*";else echo $'Wrong expiration format.\neg. 1(w/m/y), etc.';fi;fi;else echo "file doesn't exist";fi;else echo $'usage: upload file_name.ext [expiration]\nexpiration format: 1-9(w/m/y) # (w)eeks, m(onths), (y)ear';fi }
source ~/.bashrc
# 文件太大时分割文件
zip existing.zip --out new.zip -s 500m
# 上传
upload testfile.txt
# 下载
wget -O dirs.zip https://file.io/lhQ7adehy7xc
reference
Updated: 2024-05-19 22:05
Created: 2022-11-26 20:00