python开启http服务,快速传输文件

背景

今天打算将放在本地mac上的一个170M大小的文件,远程传输到服务上。由于自己mac上安装的是iterm2,开始通过lrzsz命令,在服务器上使用rz来传输。发现贼慢,难以忍受。遂找快速传输文件的方法。

开始想在自己的mac上起ftp服务,折腾半天,没搞定。突然想到python 可以临时起http服务。试了这种方案,简直大杀器,速度快的爆炸。

step1 mac机器上起http服务

进入到要上传文件的目下,执行如下python脚本命令

Python <= 2.3
python -c "import SimpleHTTPServer as s; s.test();" 8000

Python >= 2.4
python -m SimpleHTTPServer 8000

Python 3.x
python -m http.server 8000

step2 访问临时起的http服务,如下图,进行check

step3 登录服务器,使用wget 下载mac的http服务

wget http://10.180.205.28:8000/text-classification-cnn-rnn.tar

原文地址:https://www.cnblogs.com/syw-home/p/13679256.html