Linux command line operation Baidu cloud upload and download files

Linux command line operation Baidu cloud upload and download files

0. Background

Many times we can only connect to the server remotely through the ssh tool, and there is often no graphical interface. We can use ssh or ftp to upload and download large files. At this time, the download rate is limited by the server bandwidth. Since I am currently connecting to the school server at home by building my own frp to do intranet penetration, the upload and download speed depends on the frp server. Since the bandwidth is only 4M, uploading and downloading large files over 20G, the upload and download speed is about 500KB, which is time-consuming and laborious. I found a good project on github https://github.com/houtianze/bypy, which can use Baidu Cloud to speed up uploading and downloading, provided that you have a Baidu Cloud membership.

1. Installation

pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ bypy==1.7.5

2. Log in to your Baidu Cloud account

Input: bypy info

Then log in: https://openapi.baidu.com/oauth/2.0/authorize?client_id=q8WE4EpCsau1oS0MplgMKNBn&response_type=code&redirect_uri=oob&scope=basic+netdisk

Get the authorization code as shown below:

insert image description here

After connecting to the network disk, some authorization files will be generated in the ~/.bypy directory. No authorization is required for using bypy next time. If you want to quit authorization, you can rm -rf ~/.bypy/ .

3. Upload files

After uploading the file, it will be saved in the directory of All Files/My Application Resources/bypy (that is, /app/bypy/).

Upload the specified file: bypy upload 文件名to the current directory: bypy upload

4. Download the file

Due to Baidu PCS API permission restrictions, the program can only access files and directories under the Baidu Cloud/apps/bypy directory . Currently, the speed seems to be limited, and the download speed is stable at 5MB/s, but it is much better than 500KB/s.

Download the specified file: bypy downfile 文件名download current directory: bypy downfile -v ; -v displays detailed information

insert image description here

5. Other commands

bypy : Display usage help and all commands

bypy compare : compare the current directory with the cloud disk root directory ( /apps/byby )

bypy syncdown : sync the cloud disk content to the local

bypy syncup : synchronize the current directory to the cloud disk

bypy list : Display the list of files in the root directory of the cloud disk

bypy help <command> : Get detailed information about a command

bypy mkdir : create a subdirectory in the current directory of the cloud disk

6. Python code call

from bypy import ByPybp = ByPy()bp.list() # or whatever instance methods of ByPy class

This is the end of this article about Linux command line operations to upload and download files on Baidu Cloud. For more relevant Linux operations to upload and download files on Baidu Cloud, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • How to download large files from Baidu Cloud in Linux

<<:  Negative margin function introduction and usage summary

>>:  How to perfectly implement the grid layout with intervals on the page

Recommend

How to deploy zabbix_agent in docker

zabbix_agent deployment: Recommendation: zabbix_a...

An article to quickly understand Angular and Ionic life cycle and hook functions

Table of contents Angular accomplish Calling orde...

MySQL merges multiple rows of data based on the group_concat() function

A very useful function group_concat(), the manual...

Summary of Ubuntu backup methods (four types)

Method 1: To use respin, follow these steps: sudo...

Introduction to network drivers for Linux devices

Wired network: Ethernet Wireless network: 4G, wif...

Installation steps of Ubuntu 20.04 double pinyin input method

1. Set up Chinese input method 2. Set the double ...

I have compiled a few cool design sites that I think are good.

You must have inspiration to design a website. Goo...

Detailed tutorial on deploying Springboot or Nginx using Kubernetes

1 Introduction After "Maven deploys Springbo...

MySQL 8.0 WITH query details

Table of contents Learning about WITH queries in ...

How to automatically number the results of MYSQL query data

Preface In fact, I have never encountered this ki...

Detailed explanation of how to create an array in JavaScript

Table of contents Creating Arrays in JavaScript U...

Detailed tutorial on replacing mysql8.0.17 in windows10

This article shares the specific steps of replaci...

Some tips on website design

In fact, we have been hearing a lot about web des...

Detailed explanation of three commonly used web effects in JavaScript

Table of contents 1 element offset series 1.1 Off...