This content originally appeared on DEV Community and was authored by Babs
In my work environment, I deal with multiple operating systems hosted on different virtual machines. A frequent challenge I face is transferring files between these systems β especially when copy-paste and drag-and-drop functionalities are disabled for security reasons.
Ideally, if all these systems existed within the same Active Directory (AD) domain, I couldβve easily used a shared network folder. But thatβs not the case. Fortunately, I discovered a simple yet powerful solution usingβ¦ Python!
Who wouldβve thought a snake would solve my file-sharing problem?
The Quickest Cross-OS File Sharing Method
With Pythonβs built-in web server, I can now instantly share files between any operating system β as long as theyβre on the same network. Itβs basically the fastest version of AirDrop Iβve ever seen for VMs and local systems.
How to Set Up a Python Web Server on Windows
Hereβs a step-by-step guide to setting it up:
1. Install Python
Go to the official Python website and download the latest version.
During installation, make sure to check the box that says βAdd Python to PATHβ (important!).
Complete the installation.
2. Verify or Manually Add Python to System Environment Variables
In case Python isn’t added to PATH automatically:
- Press the Windows key, search for Python, right-click on the one that shows β(64-bit)β, and choose Open File Location.
- Copy the path (e.g., C:\Users\YourName\AppData\Local\Programs\Python\Python311)
Now, add this path to the system environment variables:
Search for βEnvironment Variablesβ in Windows search.
Under System Properties, click Environment Variables.
- Under System variables, click New.
For Variable Name, you can enter something like PYTHON.
For Variable Value, paste the copied Python path.
- Click OK and save.
3. Start the Python Web Server
Open Command Prompt (CMD), navigate to the folder you want to share, and run:
python -m http.server 8080
Or if python doesnβt work, try:
python3 -m http.server 8080
This starts a basic web server that serves files from the current folder on port 8080.
4. Access the Server from Another Device
Now on any device (Windows, Linux, macOS, Android, etc.) connected to the same network, open a browser and type:
http://<IP_ADDRESS>:8080
For example:
http://192.168.8.102:8080
This opens the hosted directory in a browser β allowing you to download files easily and it can also be gotten via phones to.
Troubleshooting Tip
If you get an error saying ‘python’ is not recognized as an internal or external command, it means Python isnβt properly installed or added to the system PATH.
To fix:
Just type “python” in CMD.
If it redirects you to the Microsoft Store, download Python from there.
Then repeat the earlier steps to set it up properly.
Final Thoughts
With this method, I no longer struggle with sharing files across different virtual machines and OS environments. Itβs lightweight, doesn’t require external tools, and works instantly over LAN.
Python just became my new best friend for file sharing β fast, simple, and cross-platform.
This content originally appeared on DEV Community and was authored by Babs