python trick: sharing a directory over HTTP
Translation of the original in Catalan. Read it in: CatalàCastellano
Sometimes being on the LAN itself, we sweat blood to tell a windows user how to grab a file from a directory on our linux. If you have python installed, normally all distributions install it by default along with the HTTP package. You can do something as simple as putting in your .bashrc:
alias quickweb='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
Now go to the directory where you want to share the files and write: quickweb. This will open your port 8000 and any user on the network will be able to connect with the browser to your IP on port 8000. There you can see and download the files you have there. When you want to stop sharing the directory you just need to do a Control+C and that's it.
Really a very very useful silly little thing, isn't it? if you want to check what you're sharing you already know: http://127.0.0.1:8000. Simpler impossible.
1 comment
Comments from the old blog, as they were written. Comments are closed.
Albert Coronado
Hola Oriol,
Molt bó el truc. Segur que treu de mes d'un compromís.