DEV Community

Navneet78
Navneet78

Posted on

Pro Pythonist Way to Share Files :)

Hello everyone ever Want to share files in your office work-space but don't have pendrive here it is python tip

1)Start a python server from the directory you want to share file.
python -m http.server

2)Now, go to your system's browser on http://localhost:8000, Voila! you'll see the list of files, which you can share to another computer, but how?

Step 1: Get your system's IP address. (use ifconfig in Ubuntu command line and ipconfig in Windows command prompt)

Step 2: Go to the following link having the format http://:8000 on the device you want to download file

e.g. if IP address is 192.168.0.114, go to https://192.168.0.114:8000 and you'll find the same list of files. You can download them (or play media) by simply clicking on them.
Note: This works only if both the computers/mobiles/etc. are connected to the same network i.e. if you're connected to the same WiFi or same hotspot.

Read more https://docs.python.org/3/library/http.server.html

Top comments (1)

Collapse
 
adncodez profile image
Adnan HT

You may want to specify the port to use, in case the default port which is 8000 is used, like this: python -m http.server 9090 (port number)