Linux命令行上传文件到百度网盘
2015-11-28 11:53
591 查看
利用bpcs_uploader你可以自动将VPS主机上的文件上传到百度网盘中,同时也可以从百度网盘中下载文件到VPS主机上,让你的文件安全地“住”在百度云中。[font=Tahoma, 'Microsoft Yahei', Simsun]百度云空间容量大,且有了百度这个靠山,日后也不必担心网盘关门走人,随着众多国内网盘开始投放大量的广告到网盘下载页面(典型的有华为网盘、下载赚钱网盘),百度网盘清爽的风格就显得难能可贵了。将文件上传到百度云中就可以方便其它用户下载
1.安装wdcp
wget http://down.wdlinux.cn/in/lanmp_wdcp_ins.sh
sh lanmp_wdcp_ins.sh
2.下载bpcs_uploader上传脚本
https://github.com/oott123/bpcs_uploader/tarball/master
给chmod +x bpcs_uploader.php执行权限
3.查看php路径
/www/wdlinux/nginx_php-5.2.17/bin/php –v
将bpcs_uploader.php第一行修改成
#!/www/wdlinux/nginx_php-5.2.17/bin/php -ddisable_functions -d safe_mode=Off
复制代码
[root@VM_166_159_centos oott123-bpcs_uploader-3a75324]# ./bpcs_uploader.php quickinit
===========================Baidu PCS Uploader===========================
Usage: ./bpcs_uploader.php init|quickinit|quota
Usage: ./bpcs_uploader.php upload|download path_local path_remote
Usage: ./bpcs_uploader.php delete path_remote
Usage: ./bpcs_uploader.php uploadbig path_local path_remote [slice_size(default:1073741824)] [temp_dir(def:/tmp/)]
Usage: ./bpcs_uploader.php fetch path_remote path_to_fetch
========================================================================
Uploader initialization will be begin. If you have already configured the uploader before, y our old settings will be overwritten.
Continue? [y/N] y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
171 263 0 263 0 80 671 204 --:--:-- --:--:-- --:--:-- 3210
Launch your favorite web browser and visit https://openapi.baidu.com/device Input 2a24n8dv as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
244 101 0 101 0 143 531 753 --:--:-- --:--:-- --:--:-- 0
OAuth error authorization_pending : User has not yet completed the authorization
Authentication failed. Please check the error message and try again.
Launch your favorite web browser and visit https://openapi.baidu.com/device Input 2a24n8dv as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
Continue? [y/N] y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
244 101 0 101 0 143 546 773 --:--:-- --:--:-- --:--:-- 0
OAuth error authorization_pending : User has not yet completed the authorization
Authentication failed. Please check the error message and try again.
Launch your favorite web browser and visit https://openapi.baidu.com/device Input 2a24n8dv as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
Continue? [y/N] y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
180 397 0 397 0 143 2162 778 --:--:-- --:--:-- --:--:-- 5772
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 66 0 66 0 0 220 0 --:--:-- --:--:-- --:--:-- 366
Access Granted. Your Storage Status: 105.95G/2063.00G (5.14%)
Enjoy!
以上为快速初始化代码,输入授权码网址:https://openapi.baidu.com/device
1.
然后打开浏览器访问 https://openapi.baidu.com/device ,在“请输入设备上显示的用户授权码:”文本框中输入上面显示的授权码,并点击继续。 看到网页上显示“请返回设备继续操作!”后,返回ssh上按下回车后,即完成了初始化配置。
重新分配
[root@VM_166_159_centos oott123-bpcs_uploader-3a75324]# ./bpcs_uploader.php init
===========================Baidu PCS Uploader===========================
Usage: ./bpcs_uploader.php init|quickinit|quota
Usage: ./bpcs_uploader.php upload|download path_local path_remote
Usage: ./bpcs_uploader.php delete path_remote
Usage: ./bpcs_uploader.php uploadbig path_local path_remote [slice_size(default:1073741824)] [temp_dir(def:/tmp/)]
Usage: ./bpcs_uploader.php fetch path_remote path_to_fetch
========================================================================
Uploader initialization will be begin. If you have already configured the uploader before, your old settings will b e overwritten.
Continue? [y/N] y
Please enter your PSC App API Key. You can get this key by visiting http://developer.baidu.com/dev#/create If you have already created an app, you can visit http://developer.baidu.com/console#/app and get it in your app's info.
If you don't want to bother creating an app, you can press Enter to use the demo API Key.
Doing so (without your own API Key/Secret) will cause the access-token to expire every 30 days, and you'll have to
re-initialize when it expires.
App API KEY [uFBSHEwWE6DD94SQx9z77vgG] :uFBSHEwWE6DD94SQx9z77vgG
App API Key has been set to uFBSHEwWE6DD94SQx9z77vgG .
Demo key detected. Using default API Secret.
Demo key detected. Using default app name.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
171 263 0 263 0 80 1355 412 --:--:-- --:--:-- --:--:-- 3452
Launch your favorite web browser and visit https://openapi.baidu.com/device Input axmhkper as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
179 395 0 395 0 143 2010 727 --:--:-- --:--:-- --:--:-- 5250
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 67 0 67 0 0 294 0 --:--:-- --:--:-- --:--:-- 690
Access Granted. Your Storage Status: 105.95G/2063.00G (5.14%)
4.我们测试上传文件 复制代码
./bpcs_uploader.php upload /www/jiaoguan.txt /www/jiaoguan. txt
===========================Baidu PCS Uploader===========================
Usage: ./bpcs_uploader.php init|quickinit|quota
Usage: ./bpcs_uploader.php upload|download path_local path_remote
Usage: ./bpcs_uploader.php delete path_remote
Usage: ./bpcs_uploader.php uploadbig path_local path_remote [slice_size(default:1073741824)] [temp_dir(def:/tmp/)]
Usage: ./bpcs_uploader.php fetch path_remote path_to_fetch
========================================================================
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
197 397 0 397 0 195 1791 880 --:--:-- --:--:-- --:--:-- 2767
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
131 394 185 185 104 209 242 274 --:--:-- --:--:-- --:--:-- 337
File /apps/bpcs_uploader//www/jiaoguan.txt uploaded.
Size:0.019K MD5 Sum:a19e55943b85fe27417653593b6c80e4
测试完工!WDCP自动化运维脚本将于明天发布!
如有问题请加本人QQ:6870608 纯原创 转载注明版权 本文首发腾讯云
1.安装wdcp
wget http://down.wdlinux.cn/in/lanmp_wdcp_ins.sh
sh lanmp_wdcp_ins.sh
2.下载bpcs_uploader上传脚本
https://github.com/oott123/bpcs_uploader/tarball/master
给chmod +x bpcs_uploader.php执行权限
3.查看php路径
/www/wdlinux/nginx_php-5.2.17/bin/php –v
将bpcs_uploader.php第一行修改成
#!/www/wdlinux/nginx_php-5.2.17/bin/php -ddisable_functions -d safe_mode=Off
复制代码
[root@VM_166_159_centos oott123-bpcs_uploader-3a75324]# ./bpcs_uploader.php quickinit
===========================Baidu PCS Uploader===========================
Usage: ./bpcs_uploader.php init|quickinit|quota
Usage: ./bpcs_uploader.php upload|download path_local path_remote
Usage: ./bpcs_uploader.php delete path_remote
Usage: ./bpcs_uploader.php uploadbig path_local path_remote [slice_size(default:1073741824)] [temp_dir(def:/tmp/)]
Usage: ./bpcs_uploader.php fetch path_remote path_to_fetch
========================================================================
Uploader initialization will be begin. If you have already configured the uploader before, y our old settings will be overwritten.
Continue? [y/N] y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
171 263 0 263 0 80 671 204 --:--:-- --:--:-- --:--:-- 3210
Launch your favorite web browser and visit https://openapi.baidu.com/device Input 2a24n8dv as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
244 101 0 101 0 143 531 753 --:--:-- --:--:-- --:--:-- 0
OAuth error authorization_pending : User has not yet completed the authorization
Authentication failed. Please check the error message and try again.
Launch your favorite web browser and visit https://openapi.baidu.com/device Input 2a24n8dv as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
Continue? [y/N] y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
244 101 0 101 0 143 546 773 --:--:-- --:--:-- --:--:-- 0
OAuth error authorization_pending : User has not yet completed the authorization
Authentication failed. Please check the error message and try again.
Launch your favorite web browser and visit https://openapi.baidu.com/device Input 2a24n8dv as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
Continue? [y/N] y
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
180 397 0 397 0 143 2162 778 --:--:-- --:--:-- --:--:-- 5772
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 66 0 66 0 0 220 0 --:--:-- --:--:-- --:--:-- 366
Access Granted. Your Storage Status: 105.95G/2063.00G (5.14%)
Enjoy!
以上为快速初始化代码,输入授权码网址:https://openapi.baidu.com/device
1.
然后打开浏览器访问 https://openapi.baidu.com/device ,在“请输入设备上显示的用户授权码:”文本框中输入上面显示的授权码,并点击继续。 看到网页上显示“请返回设备继续操作!”后,返回ssh上按下回车后,即完成了初始化配置。
重新分配
[root@VM_166_159_centos oott123-bpcs_uploader-3a75324]# ./bpcs_uploader.php init
===========================Baidu PCS Uploader===========================
Usage: ./bpcs_uploader.php init|quickinit|quota
Usage: ./bpcs_uploader.php upload|download path_local path_remote
Usage: ./bpcs_uploader.php delete path_remote
Usage: ./bpcs_uploader.php uploadbig path_local path_remote [slice_size(default:1073741824)] [temp_dir(def:/tmp/)]
Usage: ./bpcs_uploader.php fetch path_remote path_to_fetch
========================================================================
Uploader initialization will be begin. If you have already configured the uploader before, your old settings will b e overwritten.
Continue? [y/N] y
Please enter your PSC App API Key. You can get this key by visiting http://developer.baidu.com/dev#/create If you have already created an app, you can visit http://developer.baidu.com/console#/app and get it in your app's info.
If you don't want to bother creating an app, you can press Enter to use the demo API Key.
Doing so (without your own API Key/Secret) will cause the access-token to expire every 30 days, and you'll have to
re-initialize when it expires.
App API KEY [uFBSHEwWE6DD94SQx9z77vgG] :uFBSHEwWE6DD94SQx9z77vgG
App API Key has been set to uFBSHEwWE6DD94SQx9z77vgG .
Demo key detected. Using default API Secret.
Demo key detected. Using default app name.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
171 263 0 263 0 80 1355 412 --:--:-- --:--:-- --:--:-- 3452
Launch your favorite web browser and visit https://openapi.baidu.com/device Input axmhkper as the user code if asked.
After granting access to the application, come back here and press Enter to continue.
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
179 395 0 395 0 143 2010 727 --:--:-- --:--:-- --:--:-- 5250
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 67 0 67 0 0 294 0 --:--:-- --:--:-- --:--:-- 690
Access Granted. Your Storage Status: 105.95G/2063.00G (5.14%)
4.我们测试上传文件 复制代码
./bpcs_uploader.php upload /www/jiaoguan.txt /www/jiaoguan. txt
===========================Baidu PCS Uploader===========================
Usage: ./bpcs_uploader.php init|quickinit|quota
Usage: ./bpcs_uploader.php upload|download path_local path_remote
Usage: ./bpcs_uploader.php delete path_remote
Usage: ./bpcs_uploader.php uploadbig path_local path_remote [slice_size(default:1073741824)] [temp_dir(def:/tmp/)]
Usage: ./bpcs_uploader.php fetch path_remote path_to_fetch
========================================================================
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
197 397 0 397 0 195 1791 880 --:--:-- --:--:-- --:--:-- 2767
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
131 394 185 185 104 209 242 274 --:--:-- --:--:-- --:--:-- 337
File /apps/bpcs_uploader//www/jiaoguan.txt uploaded.
Size:0.019K MD5 Sum:a19e55943b85fe27417653593b6c80e4
测试完工!WDCP自动化运维脚本将于明天发布!
如有问题请加本人QQ:6870608 纯原创 转载注明版权 本文首发腾讯云
相关文章推荐
- Linux Is Not Matrix——jenkins配置主从节点
- linux下查看cpu、内存和硬盘大小
- Linux下定时执行python脚本
- CentOS跨网段访问
- linux下dns设置详解
- Linux命令备忘实例(17)——cURL
- linux配置jdk环境变量
- Linux 设置 SSH 登录限制
- Centos7-mqtt消息中间件mosquitto的安装和配置
- 内核阅读之浅析Linux2.6.34内核桥接数据转发(三)
- Linux驱动开发笔记总结(一)
- linux驱动开发之key
- LINUX 6.x 内核升级全过程
- 如何在RedHat6(7) or CentOS6(7)上制作无依赖的PostgreSQL数据库的RPM包
- 再次唠叨linux中的strings命令
- Linux运维 第五阶段(二)heartbeat V2(HA)
- Centos非管理员安装Python和pip
- linux 中 ll 命令如何让查询结果按时间升序或降序排序?
- CentOS 6.7局域网内搭建NTP服务器
- linux日常管理-系统服务