Friday 13 July 2012

Fast Share Your Files Using Python Script

If you were unaware, there is a command line switch for python that lets you the python library module as a script and I'm sharing a small trick on how you can easily share your files with other computers over LAN/Internet by running a python module that lets you run the tiny web server. Isn't it great when you don't have Samba?

Fire up the terminal, change to the desired directory you wish to share and type the following command:

python -m SimpleHTTPServer


Be cautious with the cases of characters of module 'SimpleHTTPServer' else you'll never find your mistake with this command :D

Once you've run the above command, the HTTP server will start to listen on the port 8000 (by default) so the other parties will just have to open up their favorite web browser and type the correct address followed with the colon and port 8000(eg. 192.168.1.21:8000)

I hope this proves useful sometimes. :)