Python has a module named SimpleHTTPServer that implements the basic HTTP Server. This module can be used to share files quickly and easily. Executing the following command shares files and folders underneath the current directory via the HTTP server. The files so shared can then be downloaded from a web browser such as Firefox or Chrome.
In Python 2.x:
$ python -m SimpleHTTPServer [port] Serving HTTP on 0.0.0.0 port 8000 ...
By default SimpleHTTPServer listens on the port number 8000. Providing a port_number as the second argument makes the SimpleHTTPServer to listen on that particular port.
$ python -m SimpleHTTPServer 4841 Serving HTTP on 0.0.0.0 port 4841 ...
In Python 3.x:
python3 -m http.server [port]
Directory listing for / Pictures/ Projects/ Public/ Python/ Templates/ Videos/
If you’re not comfortable working in the command-line, run the following script inside the folder to share all the files and folders inside of it.
import SimpleHTTPServer import SocketServer PORT = 1234 handler = SimpleHTTPServer.SimpleHTTPRequestHandler httpd = SocketServer.TCPServer((&amp;quot;&amp;quot;,PORT), handler)) print('Serving at port', PORT) httpd.serve_forever()
Keyboard Ctrl + C to abort the HTTP server.
I find this method extremely handy way of copying files between systems, since Python is in all Linux distributions by default and oftentimes there’s no GUI available in servers. For Windows you need to get the Python installer and install it.