A lightweight, universal OneDrive upload tool for all platforms

简体中文

OneDriveUploader

MoeClub wrote a very good version, but unfortunately it's not open source and hasn't been updated in a while. This project is a simple upload tool separate from DownloadBot, making it easier to upload.

Features

  • Supports Business, Personal (Home) versions.
  • Support for uploading files and folders to specified directories, keeping the directory structure as it was before the upload.
  • Supports the use of command parameters for external applications.
  • Support for customising the upload chunk size.
  • Supports multi-threaded uploads (multiple files at the same time).
  • Support for dynamically adjusting the number of retries according to the file size.
  • Supports skipping the existing files with the same name in the OneDrive.
  • Support for real-time monitoring of upload progress via Telegram Bot, for easy monitoring of uploads when using fully automated download scripts.

Authorize

Login via the following URL (right click to open a new tab)

Business, Personal (Home) versions

https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=ad5e65fd-856d-4356-aefc-537a9700c137&response_type=code&redirect_uri=http://localhost/onedrive-login&response_mode=query&scope=offline_access%20User.Read%20Files.ReadWrite.All

Initialization profile

# Business
OneDriveUploader -a "url"

# Business, and use Chinese language pack
OneDriveUploader -a "url" -l zh-CN

# Personal (Home)
OneDriveUploader -a "url" -v 1

# The China Version (Century Internet) is currently in design and is not available
OneDriveUploader -a "url" -v 2

# Get the entire url in the browser address bar starting with http://loaclhost
# Replace the full url with the three letters of the "url" in the command
# Each url generated can only be used once, try again to retrieve the url
# This action will automatically initialise the configuration file

Use

Usage of OneDriveUploader:
  -a string
        //Setup and Init auth.json.
  -b string
        //Set block size. [Unit: M; 5<=b<=60;] (default "10")
  -c string
        //Config file.

  -r string
        //Upload to reomte path.
  -l string
        // Software language
  -f string
        // *Necessary parameters, file or folder to upload
  -t string
        // Number of threads, number of files uploaded at the same time. Default: 3
  -to int
        // The timeout time of a single packet is 60s by default
  -tgbot string
        //Use the Telegram bot to monitor uploads in real time, here you need to fill in the access token of the bot, e.g. 123456789:xxxxxxxxxx, use double quotes to wrap it
  -uid string
        // Use the Telegram bot to monitor uploads in real time, here you need to fill in the recipient's userID, shaped like 123456789
  -m int
        // Select the mode, 0 is to replace the file with the same name in onedrive, 1 is to skip, the default is 0
  -v int
        // Select the version, where 0 is the Business version and 1 is the personal (home) version, the default is 0

Config

{
    // Authorisation tokens
    "RefreshToken": "1234564567890ABCDEF",
    // Maximum number of threads. (Number of simultaneous file uploads)
    "ThreadNum": 2,
    // Maximum upload chunk size. (The maximum chunk size for each file upload, it is recommended to reduce it if the network is not good. Unit: MB)
    "BlockSize": 10,
    // Maximum single file size. (Currently: 100GB single file limit for Personal Edition (Home Edition); 15GB single file limit for other editions, Microsoft will update to 100GB over time. Unit: GB)
    "SigleFile": 100,
    // If this is the Chinese version (CenturyLink), this should be true.
    "MainLand": false,
    //Software language
    "Language": "zh-CN",
    //timeout
    "TimeOut": 60,
    //Telegram Bot key
    "BotKey": "",
    //Telegram User ID
    "UserID": ""
}

Note that when a configuration file is used at the same time and the parameters in the configuration file are not the default values, the parameters in the configuration file will be used by default, and when parameters are entered on the command line, the parameters currently entered on the command line will be used and the parameters in the configuration file will be changed. That is, the parameters in the command line take precedence over the parameters in the configuration file and will change the parameters in the configuration file.

Examples

# Some examples:

# Upload the mm00.jpg file from the same directory to the root of the OneDrive
OneDriveUploader -c xxx.json -f "mm00.jpg"

# Upload the Download folder from the same directory to the root of the OneDrive
OneDriveUploader -c xxx.json -f "Download" 

# Upload the Download folder from the same directory to the Test directory of the OneDrive
OneDriveUploader -c xxx.json -f "Download" -r "Test"

# Upload the Download folder from the same directory to the root of the OneDrive, using 10 threads
OneDriveUploader -c xxx.json -t 10 -f "Download" 

# Upload the download folder in the same directory to the root directory of onedrive, use 10 threads, and skip the file with the same name
OneDriveUploader -c xxx.json -t 10 -f "Download" -m 1

# Upload the download folder in the same directory to the root directory of onedrive, use 10 threads, and set the timeout to 30 seconds
OneDriveUploader -c xxx.json -t 10 -f "Download" -to 30

# Upload the Download folder from the same directory to the root of the OneDrive, using 10 threads, while using Telegram Bot to monitor the progress of the upload in real time
OneDriveUploader -c xxx.json -t 10 -f "Download" -tgbot "123456:xxxxxxxx" -uid 123456789

# Upload the download folder in the same directory to the root directory of onedrive network disk, use 10 threads, and use the telegram BOT parameter loader in the configuration file to monitor the upload progress in real time (provided that the configuration file contains the parameters of telegram BOT)
OneDriveUploader -c xxx.json -t 10 -f "Download" -tgbot "1"


# Upload the Download folder from the same directory to the root of the OneDrive, using 15 threads, and setting the chunk size to 20M
OneDriveUploader -c xxx.json -t 15 -b 20 -f "Download" 

Note

Returns 0 when there is no problem with the upload, which can be used as evidence of whether the upload has failed or not

Owner
高玩梁
私、気になります
高玩梁
Comments
  • OD报错

    OD报错

    panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x95641b]

    goroutine 1 [running]: main.DirSize.func1(0x7ffd5e48483f, 0x8, 0x0, 0x0, 0xb93ac0, 0xc00030a210, 0xc000233a80, 0x43d0ce) D:/program_data/go/LightUploader/main.go:241 +0x2b path/filepath.Walk(0x7ffd5e48483f, 0x8, 0xc000233a98, 0xc000233aa8, 0x768afa) D:/program_app/go/src/path/filepath/path.go:404 +0x6a main.DirSize(0x7ffd5e48483f, 0x8, 0xfcb820, 0x0, 0x0) D:/program_data/go/LightUploader/main.go:240 +0x66 main.main() D:/program_data/go/LightUploader/main.go:329 +0x107d

  • 尝试授权时提示报错

    尝试授权时提示报错

    panic: runtime error: index out of range [1] with length 0

    goroutine 1 [running]: main/graph/net/http.getAccessToken(0x7ffdee3a283d, 0x3e, 0x0, 0xaba01c, 0x2, 0x0, 0x0) D:/program_data/go/LightUploader/graph/net/http/OAuth2.go:115 +0xc41 main/graph/net/http.NewPassCheck(0x7ffdee3a283d, 0x3e, 0x0, 0xaba01c, 0x2, 0x0, 0x0) D:/program_data/go/LightUploader/graph/net/http/OAuth2.go:42 +0x92 main.ApplyForNewPass(0x7ffdee3a283d, 0x3e, 0x0, 0x5f, 0x0) D:/program_data/go/LightUploader/main.go:32 +0x101 main.main() D:/program_data/go/LightUploader/main.go:403 +0xc0d

    服务器是centos7

  • 关于Google Driver上传的两个问题

    关于Google Driver上传的两个问题

    我根据您博客上的文章进行设置,成功设置了Google Driver的配置文件并且使用命令成功进行了手动上传,非常感谢您,但是在上传过程中出现了一些令人不悦的小问题,在这里想请问一下。 1.在上传时,无法使用-r参数设置上传的目录,只能上传至根目录,我不太清楚这个是不是目前的限制。 2.在上传时,除了上传我所需要的文件,另外它(Download bot)还在我Google Driver的根目录建立了一个同名文件夹。 3.我注意到您博客上的文章中使用“”将上传的文件和目标目录包覆了起来,我不太明白这样做的必要性,因为我尝试过不使用“”,发现也是同样可以使用的。

    最后附上为数不多的日志:/root/LightUploader -c xxxx.json -f "/path/bakfile" -r "/backup" /path/bakfile 开始上传,大小: xx KB2021/09/27 22:28:42 /bakfile /root /path `bakfile开始上传至Google Drive

  • 同样上传出错

    同样上传出错

    cpu卡死后重启再上传显示: 2021/05/14 16:59:13 EOF panic: EOF

    goroutine 1 [running]: log.Panicln(0xc00003fdc8, 0x1, 0x1) D:/program_app/go/src/log/log.go:365 +0xac main.main() D:/program_data/go/onedrive/main.go:290 +0x1695

  • 大佬,这是什么问题

    大佬,这是什么问题

    LightUploader -c XXXX.json -f “/root/down/.rtorrent/犬夜叉/” panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x95781b]

  • GD初始化报错

    GD初始化报错

    root@ecs-FalW8:~# LightUploader -v 3
    panic: message "googleDriveGetAccess" not found in language "en"
    
    goroutine 1 [running]:
    github.com/nicksnyder/go-i18n/v2/i18n.(*Localizer).MustLocalize(0xc0004673a0, 0xc0003afd78, 0x2, 0x2)
            D:/program_data/go/LightUploader/vendor/github.com/nicksnyder/go-i18n/v2/i18n/localizer.go:211 +0x79
    main.(*Loc).print(...)
            D:/program_data/go/LightUploader/i18n.go:136
    main.main()
            D:/program_data/go/LightUploader/main.go:392 +0x766
    

    https://imglink.win/image/2021/04/29/wnOn7.png

  • 上传GD一段时间后报错

    上传GD一段时间后报错

    ovh法国机器,系统是ubuntu,上传GD一段时间后报错,试过几次了,看样子是发送TG信息的请求频率太高了?

    /root/LightUploader -c /root/[email protected] -t 1 -f "XXXX" -tgbot "XXXXXX" -uid XXXXX

    2022/03/09 14:43:47 Telegram Send Error:Too Many Requests: retry after 122
    panic: Telegram Send Error:Too Many Requests: retry after 122
    
    goroutine 1 [running]:
    log.Panicf({0xc0000de620, 0x22}, {0xc0017211d8, 0xc0017211c8, 0x3})
            D:/program_app/go/src/log/log.go:361 +0x67
    main.botSend({0x7ffc536bb31f, 0x95bbf8}, {0x7ffc536bb353, 0xc00013407e}, {0xc00049a7c0, 0x36})
            D:/program_data/go/LightUploader/main.go:218 +0x565
    main/googledrive.UploadAllFile({0xc000134050, 0x43}, {0xc001105d50, 0x1, 0x1}, 0xc0003a2400, 0xc0000001a0, {0xc000028180, 0x11}, 0xc000060280, ...)
            D:/program_data/go/LightUploader/googledrive/gdUpload.go:205 +0x183
    main/googledrive.UploadAllFile({0x7ffc536bb2ea, 0x2d}, {0x0, 0x0, 0x0}, 0xc0003a2400, 0xa, {0xc000028180, 0x11}, 0xc000060280, ...)
            D:/program_data/go/LightUploader/googledrive/gdUpload.go:253 +0xb6c
    main/googledrive.Upload({0x7ffc536bb2c5, 0x1c}, {0x7ffc536bb2ea, 0x2d}, 0x100000000000000, 0x98a888, 0x10, 0x10, {0x95bd94, 0x2}, ...)
            D:/program_data/go/LightUploader/googledrive/gdUpload.go:435 +0x414
    main.main()
            D:/program_data/go/LightUploader/main.go:375 +0x101d
    
    
  • 无法上传整个文件夹

    无法上传整个文件夹

    panic: runtime error: slice bounds out of range [6:5]

    goroutine 43 [running]: main.main.func1({0x95ced6, 0x5}) D:/program_data/go/LightUploader/main.go:355 +0x188 main.restore.func1.2({0x95ced6, 0x5}) D:/program_data/go/LightUploader/main.go:133 +0x45 main.restore.func1({0xc000330e40, 0xb1}, {0xc00000e5c0, {0x95cce7, 0xd9e52226927933fa}}) D:/program_data/go/LightUploader/main.go:152 +0x645 created by main.restore D:/program_data/go/LightUploader/main.go:121 +0x80f

  • 上传报错

    上传报错

    文件小于4MB,进入小文件通道,上传中 2021/12/19 10:33:50 无法还原 :EOF panic: 无法还原 :EOF

    goroutine 16 [running]: log.Panicf(0xc00027fa40, 0x10, 0xc000075a20, 0x1, 0x1) D:/program_app/go/src/log/log.go:358 +0xc7 main/api/restore/upload.(*RestoreService).SimpleUploadToOriginalLoc(0xc000006580, 0xc00001db00, 0x24, 0xc0000c2000, 0x760, 0xab4969, 0x7, 0xc000018140, 0xd, 0xc000283a10, ...) D:/program_data/go/LightUploader/api/restore/upload/onedriveRestore.go:112 +0xafe main.restore.func1(0xc000296770, 0xc00004d680, 0xc0002cbd30, 0xc0002ea840, 0xc000283bc0, 0xe, 0xc000283bce, 0x24, 0xc00027fe00, 0x18, ...) D:/program_data/go/LightUploader/main.go:131 +0x559 created by main.restore D:/program_data/go/LightUploader/main.go:110 +0x245

    文件以时间命名只有中文和数字 大小为7.67 MB (8,049,325 字节) 只有这一个出错了 而且文件大于4m

  • linux 下无法上传

    linux 下无法上传

    Centos7 64 个人版 小文件提示:

    文件小于4MB,进入小文件通道,上传中   
    2021/08/22 15:05:16 无法还原 :EOF   
    panic: 无法还原 :EOF      
    

    大文件提示:

    文件: `xxx` 开始上传至OneDrive     
    账户:`xxx`    
    文件超过4MB,进入大文件通道     
    

    就退出了,也没有上传上去

    在Windows下就可以上传

A Remote Administration Tool made in golang. All controlled with a bot.
A Remote Administration Tool made in golang. All controlled with a bot.

DISGORAT Information DISGORAT is a Remote Administration Tool fully made in golang. Change the Bottoken, webhook, guild id, channelid in main.go and y

Sep 17, 2022
Feishu/Lark Open API Go Sdk, Support ALL Open API and Event Callback.

lark 中文版 README Feishu/Lark Open API Go Sdk, Support ALL Open API and Event Callback. Created By Code Generation. Install go get github.com/chyroc/lar

Jan 5, 2023
This slack-bot collects all @gophers notifications into one slack channel

slack-bot Slack bot copying reference to a ping to notifications channel The bot is designed to listen on messages containing specific tag, copy refer

Apr 11, 2022
Discordo is a lightweight, secure, and feature-rich Discord terminal client.
Discordo is a lightweight, secure, and feature-rich Discord terminal client.

discordo · [WIP] Discordo is a lightweight, secure, and feature-rich Discord terminal client. It is highly configurable and has a minimalistic user in

Jan 5, 2023
A lightweight way to mass delete old messages

discord-mass-delete A quick tool to retroactively delete all messages (or filter to specific channels / guilds), extracted from your Discord data back

Jan 5, 2023
A lightweight operating system that allows Discord channels to essentially function as terminal interfaces

KuriOS KuriOS is an lightweight operating system that allows Discord channels to essentially function as terminal interfaces. As such, all permissions

Dec 31, 2021
A tool written in GO to demonstrate how bad actors utilize requests to spam Discord Users and launch large unsolicited DM Advertisement Campaigns
A tool written in GO to demonstrate how bad actors utilize requests to spam Discord Users and launch large unsolicited DM Advertisement Campaigns

discord-mass-DM-GO A tool written in GO to demonstrate how bad actors utilize requests to spam Discord Users and launch large unsolicited DM Advertise

Jan 2, 2023
Tool to summarize and report large exchange inflows, exchange outflows, mints, and burns.

What this is Tool to summarize and report large exchange inflows, exchange outflows, mints, and burns. Data is sourced from whale-alert and reported v

Nov 11, 2022
Discord-dl: a tool to archive discord channels

discord-dl discord-dl is a tool to archive discord channels. I think it's safe t

May 18, 2022
A lightweight, universal cloud drive upload tool for all platforms

简体中文 LightUploader MoeClub wrote a very good version, but unfortunately it's not open source and hasn't been updated in a while. This project is a sim

Jan 3, 2023
Build for all Go-supported platforms by default, disable those which you don't want.

bagop Build for all Go-supported platforms by default, disable those which you don't want. Overview bagop is a simple build tool for Go which tries to

Jul 29, 2022
Build for all gccgo-supported platforms by default, disable those which you don't want (bagop with CGo support).

bagccgop Build for all gccgo-supported platforms by default, disable those which you don't want (bagop with CGo support). Overview bagccgop is a simpl

Nov 9, 2022
Flock is a project which provides a Go solution for system level file locks for all platforms Golang supports.

Flock is a project which provides a Go solution for system level file locks for all platforms Golang supports.

Feb 8, 2022
Lightweight selfhosted Firefox Send alternative without public upload
Lightweight selfhosted Firefox Send alternative without public upload

Gokapi Available for: Bare Metal Docker About Gokapi is a lightweight server to share files, which expire after a set amount of downloads or days. It

Jan 5, 2023
MyApps is a universal command line tool for managing manually installed applications.
MyApps is a universal command line tool for managing manually installed applications.

MyApps MyApps is a universal command line tool for managing manually installed applications. Disclaimer I wrote this tool over two long nights while p

Jul 15, 2022
A golang tool to list out all EKS clusters with active nodegroups in all regions in json format

eks-tool A quick and dirty tool to list out all EKS clusters with active nodegro

Dec 18, 2021
Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.

Packer Website: https://www.packer.io IRC: #packer-tool on Freenode Mailing list: Google Groups Packer is a tool for building identical machine images

Jan 8, 2023
PingMe is a CLI tool which provides the ability to send messages or alerts to multiple messaging platforms & email.
PingMe is a CLI tool which provides the ability to send messages or alerts to multiple messaging platforms & email.

PingMe is a personal project to satisfy my needs of having alerts, most major platforms have integration to send alerts but its not always useful, either you are stuck with one particular platform, or you have to do alot of integrations. I needed a small app which i can just call from my backup scripts, cron jobs, CI/CD pipelines or from anywhere to send a message with particular information. And i can ship it everywhere with ease. Hence, the birth of PingMe.

Dec 28, 2022
tfacon is a CLI tool for connecting Test Management Platforms and Test Failure Analysis Classifier.

Test Failure Classifier Connector Description tfacon is a CLI tool for connecting Test Management Platforms and Test Failure Analysis Classifier. Test

Jun 23, 2022
Holly🪴 o!rdr command line tool to upload replays to it from the terminal

Holly ?? o!rdr command line tool to upload replays to it from the terminal Holly is a CLI that allows you to upload osu! replays to o!rdr from the ter

Apr 25, 2022