I was using Alibaba Cloud disk during the internal test, and the overall experience is quite good, at least there is no speed limit, which is much better than a certain KB
junk cloud disk with a download speed of only a dozen speeds.
Of course, in addition to using the client of each system to download, I also want to operate on the command line. The main reason is that I have a server and NAS
need to use the command line to download movies and other related resources.
GitHub
Found an Aliyun Pan command line tool on : https://github.com/tickstep/aliyunpan .
The specific installation methods, operation commands and tutorials have been written in detail by the official, so I won’t go into details here. Here I mainly summarize some commands and operations that I have used in the process of use that are not officially available.
Install
Install through the package management tools of each platform or install through the installation package on the official release page (need to determine different CPU
architectures).
Log in
After installation, you can aliyunpan login
log in to the cloud disk with the command.
aliyunpan login
请输入RefreshToken, 回车键提交 > 626a27b6193f4c5ca6ef0.......
You need to log in to Alibaba Cloud Disk refresh_token
, so you need to log in to Alibaba Cloud Disk on the web first, and then Local Storage
find it in refresh_token
.
switch download directory
After logging in, don’t worry about downloading. First, let’s determine the download directory of our server. If you don’t set the download directory, the cloud disk will use the default path.
Switch download directory:
aliyunpan config set --savedir /root/nas-os/downloads
download
After logging in to the cloud disk, you can use ls
the command to view the files in the cloud disk. pwd
After confirming the download path through the command, you can download it. There is only one download command.
aliyunpan download 电影/大话西游之月光宝盒.mkv
But there are still some problems with this download. If I download a large amount, the download will stop after the terminal exits. At this time, the background needs to be used to perform the download task.
aliyunpan download 电影/ > log.txt &
&
Let the task execute in the background, and then output the result to log.txt
the file, and then we can tail
check the download progress at any time through .
tail -f log.txt
tidy
After the resources are downloaded, we can organize the resources. First, we need to change the permissions of the downloaded resources to 777
, so that other accounts can also operate on them.
chmod 777 -R /root/nas-os/downloads
If the downloaded resources have many redundant files and many directory levels, and the redundant files need to be deleted, it would be too stupid to choose to delete manually at this time.
Linux
There is always a good way under , you can use find
the command to find the file and delete it.
find . -type f -name '*.nfo' -delete
find . -type f -name '*.jpg' -delete
find . -type f -name '*.png' -delete
find . -type d -name 'metadata' | xargs rm -rf
-type f
Find files, -type d
find directories.
If the names of many downloaded resources are messy, such as the naming methods of movies and TV series, sometimes we don’t need so much redundant information, then we can batch rename the file names through scripts.
ls | while read f; do mv $f ${f/修改之前的字符串/修改之后的字符串}; done
For example: Naruto.Shippuuden.2007.E1.WEB-DL.4k.H265.AAC-HDCTV.mkv
modify the file 第1集.mkv
to execute the following command.
ls | while read f; do mv $f ${f/Naruto.Shippuuden.2007.E/第}; done
ls | while read f; do mv $f ${f/.WEB-DL.4k.H265.AAC-HDCTV/集}; done