使用Python开启一个内置下载服务器
需求
有时我们要从其他的远程机器上下载一些文件到别的远程机器上,常规的方法是下到本地,再传到需要的地方,可是这么来回折腾不仅浪费时间,还有随时有可能出错。利用python我们可以直接建立一个临时的文件下载服务。
查看当前python版本
# python -V
python2开启下载器
# cd 文件所在目录 # python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...
python3开启下载器
# cd 文件所在目录 # python -m http.server Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
防火墙放行8000端口
下载文件
- 访问:http://server_ip:8000

