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

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

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

说明:博主很久前分享过使用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,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
(25)个小伙伴在吐槽
  1. Ahaa, its nice discussion regarding this piece of writing at this place at this website, I have read all that, so now me also commenting here.
    hosting services2020-09-01 01:53 回复 Windows 7 | Internet Explorer 9.0
  2. Greetings from Florida! I'm bored to tears at work so I decided to browse your blog on my iphone during lunch break. I really like the knowledge you provide here and can't wait to take a look when I get home. I'm shocked at how quick your blog loaded on my mobile .. I'm not even using WIFI, just 3G .. Anyways, wonderful blog!
    black mass2020-08-31 12:05 回复 Linux | Chrome 67.0.3396.79
  3. Hi there, always i used to check weblog posts here in the early hours in the morning, for the reason that i like to find out more and more.
    website hosting services2020-08-25 16:34 回复 Mac OS X | Chrome 53.0.2785.143
  4. I am really enjoying the theme/design of your weblog. Do you ever run into any web browser compatibility problems? A small number of my blog visitors have complained about my website not operating correctly in Explorer but looks great in Chrome. Do you have any recommendations to help fix this issue? 2CSYEon cheap flights
    cheap flights2020-08-25 12:36 回复 Linux | Firefox浏览器 4E2F
  5. Piece of writing writing is also a excitement, if you be acquainted with then you can write if not it is complex to write.
    cheap flights2020-08-24 11:33 回复 Mac OS X | Chrome 66.0.3359.66
  6. Keep on working, great job!
    web hosting companies2020-08-14 10:04 回复 Linux | Safari浏览器 605.1.15
  7. We stumbled over here coming from a different web address and thought I should check things out. I like what I see so i am just following you. Look forward to looking over your web page repeatedly.
    content hosting2020-08-12 01:34 回复 Linux | Firefox浏览器 52.9
  8. This is a great tip particularly to those new to the blogosphere. Simple but very accurate info… Appreciate your sharing this one. A must read post!
    web hosting sites2020-08-07 19:25 回复 Mac OS X | Chrome 65.0.3325.181
  9. Spot on with this write-up, I actually feel this amazing site needs a great deal more attention. I'll probably be back again to read through more, thanks for the info!
    hosting services2020-08-06 19:09 回复 Windows 7 | 360浏览器 SE
  10. Sweet blog! I found it while searching on Yahoo News. Do you have any suggestions on how to get listed in Yahoo News? I've been trying for a while but I never seem to get there! Cheers
    web hosting companies2020-08-06 01:36 回复 Mac OS X | Safari浏览器 601.1.27
  11. Everyone loves what you guys tend to be up too. This kind of clever work and reporting! Keep up the very good works guys I've included you guys to my blogroll. adreamoftrains website host
    adreamoftrains best website hosting2020-07-30 18:13 回复 Linux | 未知浏览器
  12. Great post.
    kayak2020-07-29 12:59 回复 Linux | Chrome 66.0.3359.139
  13. Thank you for sharing your info. I truly appreciate your efforts and I will be waiting for your next write ups thank you once again.
    flight2020-07-28 09:18 回复 Windows 7 | Opera 9.80
  14. Hello There. I found your weblog using msn. That is a very smartly written article. I will make sure to bookmark it and return to learn more of your useful information. Thank you for the post. I will definitely return.
    gotogate2020-07-27 19:15 回复 Windows 7 | 360浏览器 SE
  15. It's an remarkable paragraph for all the internet visitors; they will get benefit from it I am sure.
    best web hosting company2020-07-26 09:24 回复 Linux | Chrome 66.0.3359.170
  16. Hey there! This is my 1st comment here so I just wanted to give a quick shout out and say I genuinely enjoy reading your posts. Can you recommend any other blogs/websites/forums that go over the same topics? Thanks!
    web hosting service2020-07-25 13:38 回复 Linux | Firefox浏览器 60.0.2
  17. hello there and thank you for your information – I've certainly picked up anything new from right here. I did however expertise several technical points using this web site, as I experienced to reload the web site a lot of times previous to I could get it to load properly. I had been wondering if your web host is OK? Not that I am complaining, but slow loading instances times will sometimes affect your placement in google and can damage your high-quality score if ads and marketing with Adwords. Anyway I am adding this RSS to my email and can look out for a lot more of your respective intriguing content. Ensure that you update this again soon.
    best website hosting2020-07-23 12:32 回复 Linux | Chrome 66.0.3359.117
  18. I enjoy what you guys tend to be up too. This kind of clever work and reporting! Keep up the wonderful works guys I've incorporated you guys to our blogroll.
    best website hosting2020-07-22 10:26 回复 Linux | Chrome 66.0.3359.170
  19. My spouse and I stumbled over here by a different web address and thought I might check things out. I like what I see so now i am following you. Look forward to finding out about your web page yet again.
    website hosting services2020-07-18 13:26 回复 Windows Vista | Firefox浏览器 3.1b3
  20. 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
  21. 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
  22. 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
  23. 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
  24. 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
  25. 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