Share Files Between Computers and Phones Instantly with a One‑Line Python HTTP Server

This guide shows how to quickly share files from a PC to another computer or a mobile device without a USB drive by running a single Python command that starts a simple HTTP server, covering preparation, command execution, IP discovery, and accessing the shared files via a browser.

Open Source Linux
Open Source Linux
Open Source Linux
Share Files Between Computers and Phones Instantly with a One‑Line Python HTTP Server

Prerequisites

1. Need to copy files from one computer to another without a USB drive. 2. Want to access computer files from a phone. 3. Forgot the USB drive.

All these situations can be solved with a single line of Python code.

Specific Steps

Preparation before the experiment: Python 3 is installed on the machine. Python is added to the system PATH (so it can be invoked from the command line). The local firewall is disabled or port 9527 is allowed.

1. Open cmd in the folder you want to share

Hold the Shift key and right‑click in the folder, then select "Open command window here" to launch the terminal.

2. Enter the command in the cmd window

Run the following command (choose any free port you like):

python -m http.server 9527 # port number

3. Find the local IP address

Open a new cmd window and run ipconfig to locate the machine's IP address.

4. Note: Both computers or the phone must be on the same router

Computer side:

Open a browser and enter IP:port (e.g., 192.168.0.105:9527). The shared folder will be displayed and files can be downloaded directly.

Mobile side:

Open a browser on the phone and enter the same address (e.g., 192.168.0.105:9527). The interface is identical to the computer side, allowing you to tap and download files.

Principle

The following diagram is taken from the official Python documentation.

For detailed information, visit:

https://docs.python.org/3/library/http.server.html#module-http.server

The http.server module is quite handy for quick file sharing.

Reference: https://blog.csdn.net/weixin_45081575/article/details/102528739

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

HTTP servercommand-linefile sharing
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.