Every once in a while you need to copy files from one computer to another. Across different operating systems, a sneakernet (read: copying files using a USB flash drive) seems to be the best option because most (if not all) computers can handle a USB. However, the process may become cumbersome because:1
- You need to copy from the first computer to the USB, then from the USB to the second computer (then delete the copy in the USB).
- If what you are trying to transfer is bigger than your USB drive you’ll have to split and join.
- You might forget some files on the first trip and have to repeat the whole process.
- You don’t have a portable USB disk drive :(
Enter Python, where the batteries are included! Here are the steps to share your files with Python’s built-in SimpleHTTPServer:
- Install Python on the first computer (the one with the files to share). This is mainly for Windows because most Linux distributions as well as Mac OS X include Python. Yeah!
- Put the two computers into the same network. For example, by connecting them using a LAN cable and setting their IP addresses to 192.168.1.1 and 192.168.1.2 respectively.
- On the first computer (with IP address 192.168.1.1), open up a
command prompt, navigate to the folder where the files are
kept. Execute the command
python -m SimpleHTTPServer.
- Now on the second computer open up a web browser (any web browser: Firefox, Chromium, even IE) and visit and download your files at http://192.168.1.1:8000
Bonus: Big list of http static server one-liners :)
This post was recovered from an archive.org snapshot of my old blog which was free and is now dead (yeah, free hosting). ↩