• 欢迎访问db1024网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏db1024吧

一个好用的OneDrive网盘上传工具,支持文件和文件夹上传

主机教程 Liam 7个月前 (11-28) 455次浏览 6个评论 扫描二维码
文章目录[隐藏]

说明:博主很久前分享过使用Shell写的OneDrive网盘上传工具→传送门,不过由于使用的是旧API,而微软使旧API强制过时,也就是强制不让用了,不让授权了,导致全部人无法使用,所以在外搬砖多日的萌咖大佬重新出山,使用Golang基于新的API写了个效率更高的上传工具,同时也修复了各种Shell版本遗留下来的小问题,该版本特点就是授权简单,无需依赖,单文件。同样的也可以配合Aria2一起自动上传,这里就再分享下,方便下有需求的人。

功能

提示:本版本为单线程,多线程即将上线,支持多个文件一起上传,经测试,速度超暴力! 
  • 支持上传文件和文件夹到指定目录,并保持上传前的目录结构。
  • 支持命令参数使用,方便外部程序调用。
  • 支持分块上传,拥有足够多的重试次数,对抗不好的网络环境。

使用

Github地址:https://github.com/MoeClub/OneList/tree/master/OneDriveUploader

这里只说Linux的用法,Windows自行理会了,且目前只支持64位系统,32位没啥人用,所以不打算支持了。

1、授权认证
点击右侧URL登录并授权,授权地址→传送门

授权后会获取一个localhost开头打不开的链接,这里只需要记住code,也就是链接中code=&中间的参数。

2、安装OneDriveUploader

wget https://raw.githubusercontent.com/MoeClub/OneList/master/OneDriveUploader/amd64/linux/OneDriveUploader -P /usr/local/bin/ chmod +x /usr/local/bin/OneDriveUploader 

3、初始化配置

#将moerats替换成你上面获取的code参数 code="moerats" OneDriveUploader -a "${code}"

如果提示Init config file: /path/to/file/auth.json类似信息,则初始化成功。

4、使用命令

OneDriveUploader -help Usage of OneDriveUploader:   -a string         Setup auth.json.   -c string         Config file. (default "auth.json")   -n string         Rename file on upload to remote.   -r string         Upload to reomte path.   -s string         Upload item. 

5、命令示例

#将当前目录下的mm00.jpg文件上传到OneDrive网盘根目录 OneDriveUploader -s "mm00.jpg"  #将当前目录下的mm00.jpg文件上传到OneDrive网盘根目录,并改名为mm01.jpg OneDriveUploader -s "mm00.jpg" -n "mm01.jpg"  #将当前目录下的Download文件夹上传到OneDrive网盘根目录 OneDriveUploader -s "Download"   #将当前目录下的Download文件夹上传到OneDrive网盘Test目录中 OneDriveUploader -s "Download" -r "Test" 

Aria2自动上传

同样的这里也会提供个配套的Aria2自动上传脚本,上传配置方法参考→传送门

上传脚本代码如下:

#!/bin/bash  GID="$1"; FileNum="$2"; File="$3"; MaxSize="15728640" RemoteDIR="";  #上传到Onedrive的路径,默认为根目录,如果要上传到MOERATS目录,""里面请填成MOERATS。 LocalDIR="/www/download/";  #Aria2下载目录,记得最后面加上/ Uploader="/usr/local/bin/OneDriveUploader"  #上传的程序完整路径,默认为本文安装的目录   if [[ -z $(echo "$FileNum" |grep -o '[0-9]*' |head -n1) ]]; then FileNum='0'; fi if [[ "$FileNum" -le '0' ]]; then exit 0; fi if [[ "$#" != '3' ]]; then exit 0; fi  function LoadFile(){   if [[ ! -e "${Uploader}" ]]; then return; fi   IFS_BAK=$IFS   IFS=$'n'   tmpFile="$(echo "${File/#$LocalDIR}" |cut -f1 -d'/')"   FileLoad="${LocalDIR}${tmpFile}"   if [[ ! -e "${FileLoad}" ]]; then return; fi   ItemSize=$(du -s "${FileLoad}" |cut -f1 |grep -o '[0-9]*' |head -n1)   if [[ -z "$ItemSize" ]]; then return; fi   if [[ "$ItemSize" -ge "$MaxSize" ]]; then     echo -ne "33[33m${FileLoad} 33[0mtoo large to spik.n";     return;   fi   ${Uploader} -s "${FileLoad}" -r "${RemoteDIR}"   if [[ $? == '0' ]]; then     rm -rf "${FileLoad}";   fi   IFS=$IFS_BAK } LoadFile;

最后经测试,该版本的上传已经完全能应对各种稀奇古怪的字符问题,如果有问题可以回复下,贴上报错代码,方便修复。


db1024 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:一个好用的OneDrive网盘上传工具,支持文件和文件夹上传
喜欢 (1)
关于作者:
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(6)个小伙伴在吐槽
  1. Hey there just wanted to give you a brief heads up and let you know a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue. I've tried it in two different web browsers and both show the same results.
    cbd oil that works 20202020-06-29 05:30 回复 Linux | Chrome 67.0.3396.0
  2. Does your blog have a contact page? I'm having trouble locating it but, I'd like to send you an email. I've got some recommendations for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it improve over time.
    cbd oil that works 20202020-06-28 09:17 回复 Linux | Chrome 63.0.3239.132
  3. I'm not sure exactly why but this weblog is loading incredibly slow for me. Is anyone else having this issue or is it a problem on my end? I'll check back later on and see if the problem still exists.
    cbd oil that works 20202020-06-27 17:28 回复 Windows 8.1 | Chrome 67.0.3396.62
  4. What's Taking place i am new to this, I stumbled upon this I have found It positively helpful and it has helped me out loads. I hope to contribute & assist other users like its aided me. Good job.
    tinyurl.com2020-06-27 14:29 回复 Windows 8.1 | Firefox浏览器 52.9
  5. It's really a great and helpful piece of information. I'm satisfied that you just shared this helpful information with us. Please keep us informed like this. Thanks for sharing.
    ww2.telechat.info2020-06-26 18:56 回复 Linux | Firefox浏览器 2.0.0.2
  6. With havin so much content do you ever run into any problems of plagorism or copyright infringement? My website has a lot of unique content I've either authored myself or outsourced but it seems a lot of it is popping it up all over the internet without my permission. Do you know any solutions to help prevent content from being stolen? I'd genuinely appreciate it.
    rsacwgxy g2020-06-22 05:33 回复 Windows 8.1 | Chrome 65.0.3325.181