A Few Handy File Transfer Tools (All Written in Python)
The file is on your computer, you want to get it onto your friend’s computer, and you’re in a hurry. Luckily, there are tools to help. All of these tools are single files, written in python, and (probably) work on Windows (although I haven’t checked)
Droopy is a wonderful little script. It’s wonderfully useful when your friend has a file they need to send to you, and you don’t want to make them install anything. Just run it (possibly with some arguments) and it will start a little miniature web-server to which anyone can upload a file, and then it exits. Command line options make it possible to optionally display a message and/or an icon on the upload page.
Woof (Web Offer One File) is the opposite to Droopy. Instead of recieving a single file, Woof sends one. It can also optionally send an entire folder as a single tar archive. Another nice feature of woof is its “-s” option, which will cause the client to be served an identical copy of the woof.py script.
These tools are meant for jobs a little larger than the ones above. The tools already mentioned concern themselves with a single all-important file transfer, which is all well and good. But like the difference between claw hammer and a sledgehammer, sometimes you just need a tool with a little more heft. That’s where these scripts come in.
This tool is only barely fancy enough to need mentioning, but the operative word here is “barely”. Unknown to almost everyone, a full-featured static HTTP server lurks within the standard python executable under the guise of an “example”. All that you have to do is call “python -m SimpleHTTPServer” in a console window, and it will happily begin serving up the current directory on port 8000.
All of these scripts are wonderful tools, just perfect for their intended niches. But sometimes, your needs are more complex. What if you need to both send and recieve multiple files? In this case, our old standby FTP comes to hand. In this case, the pyftpdlib library should be our tool of choice. While at first glance it looks rather daunting, a tarball filled with numerous files and subdirectories, the library itself consists of just one file, ftpserver.py. With a few modifications, this file can be the perfect portable, install-less FTP server. I spent about an hour today putting together a modified version and now have about the nicest little FTP server I’ve ever had the joy of playing with. Just download the FTP server library, replace the test() and main functions at the end with my 50-line changes (basically just giving it command-line options), and you’ll have a user-friendly tool for sharing any kind of files you may need. I love collecting little tools like this. One never knows when they might come in handy.