Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有可能同时上传多个文件吗 #16

Open
kdurov opened this issue Sep 16, 2021 · 2 comments
Open

有可能同时上传多个文件吗 #16

kdurov opened this issue Sep 16, 2021 · 2 comments
Assignees

Comments

@kdurov
Copy link

kdurov commented Sep 16, 2021

115的上传速度实在不敢恭维,貌似还限速到100Mbps。
尤其是上传前强制计算hash会消耗大量时间,同时多文件上传能够节省相当时长。
请问不同时运行多任务的情况下,是否有办法同时上传多个文件加速上传过程呢。

谢谢

@orzogc orzogc self-assigned this Sep 17, 2021
@362227
Copy link

362227 commented Jan 18, 2023

很需要

@362227
Copy link

362227 commented Mar 22, 2023

并发上传shell脚本:

#!/bin/bash

# 要上传的目录,结尾一定要保留"/"
dir="/var/www/html/"

# 设置同时上传数
MAX_WORKERS=3

# 上传函数
function upload_file {
    file=$1
    fake115uploader  -c 2051423373191082165 -u "$file" || fake115uploader  -c 2051423373091282165  -parts-num 44 -m "$file"
}


export -f upload_file

# Define a signal handler function to catch CTRL+C signal
function sigint_handler {
    echo "Interrupt signal received. Stopping the script."
    exit 1
}

# Trap the CTRL+C signal and call the sigint_handler function
trap sigint_handler INT

# 查找目录所有文件
find $dir -type f -print0 | \
    xargs -r -0 -P $MAX_WORKERS -I {} bash -c 'upload_file "$@"' _ {}

echo "上传完毕"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants