Share a Folder to Your Phone Over Wi-Fi
Send files from your laptop to your phone without uploading them anywhere. One command serves a folder on your Wi-Fi, and your phone opens it in the browser. No app, no cable, no cloud.
// Steps
1.Make a folder and put the files in it
❯mkdir ~/shareCopy the files you want on your phone into this folder.
2.Start sharing
❯python3 -m http.server 8000 --directory ~/shareLeave this running. It serves the folder on port 8000.
3.Find your laptop's address
❯ipconfig getifaddr en0On macOS. On Linux, use hostname -I instead.
4.Open it on your phone (same Wi-Fi)
❯http://<that address>:8000Replace <that address> with the address from step 3. Tap a file to download it.
5.Check it is running
❯curl -I http://localhost:8000You should see HTTP/1.0 200 OK.
6.Stop sharing
❯Control CPress Control C in the terminal where step 2 is running.
// Before you use it
- There is no password and no encryption. Use it only on Wi-Fi you trust.
- Anyone on the same Wi-Fi who has the address can open the folder while the server runs.
- Guest networks often block devices from seeing each other, so the phone will not connect there.
- macOS may ask whether to allow incoming connections for Python. Allow it.
- Python 3 must be installed. On macOS,
python3may prompt you to install the developer tools the first time.