One line ftp server in python

前端 未结 9 1818
清歌不尽
清歌不尽 2020-12-07 08:03

Is it possible to have a one line command in python to do a simple ftp server? I\'d like to be able to do this as quick and temporary way to transfer files to a linux box wi

9条回答
  •  粉色の甜心
    2020-12-07 08:27

    Why don't you instead use a one-line HTTP server?

    python -m SimpleHTTPServer 8000
    

    will serve the contents of the current working directory over HTTP on port 8000.

    If you use Python 3, you should instead write

    python3 -m http.server 8000
    

    See the SimpleHTTPServer module docs for 2.x and the http.server docs for 3.x.

    By the way, in both cases the port parameter is optional.

提交回复
热议问题