Share File Between Two Computers without Using third party i.e. USB or email etc.(From Quora)


Hello Everyone, many times, when you are working in a group, you want to transfer files between computers every now and then. The most common techniques used are emailing or using a USB stick [if version control cannot be used, for whatever reason]. Now, that’s pretty cumbersome after a point. So, here’s an alternative file transfer trick:
Let’s say you have the following directory on computer 1 which contains the file you want to transfer:

Open a terminal window, and cd into this directory. Then, run:python -m SimpleHTTPServer
Now, on computer 2, where you want to get the file, open a browser, and go to http://:8000
You will see the list of all files in the directory on computer 1. Click on a file to download.
You can let the server running for as long as you need to transfer files. When you add new files to the directory on computer 1 or make changes to an existing file, simply refresh the page on computer 2 and you will see the updated and new files.

Some clarifications based on comments:
  • Here are some details about how this works: 20.19. SimpleHTTPServer - Simple HTTP request handler - Python 2.7.13 documentation
  • The steps that I have described work when the two computers are connected to the same network. In that case, you will have to enter the local IP address of computer 2 in the browser of computer 1. To find your local IP address in Linux, run inifconfig Linux and look for corresponding toinet addr the network you are connected to. In Windows, run,ipconfig and look forIPv4 address
  • For machines on different networks, it becomes more tricky, since you have to set up port forwarding [if I remember correctly]. In any case, it is not a very good idea to do this over an internet, since computer 1 can read any file on computer 2’s file system [by navigating backward using ../../ etc]. So this is used primarily for the case I’ve described in the first paragraph [which is very common] — you are working in a group, sitting close-by, so that you know that no one is accessing files that you did not intend to share.

Steps on windows are pretty straight forward just like Linux [provided by Aseem Yadav]:
  • Here’s the directory you want to share:
  • Open it in command prompt, and run ipconfig
  • Run python -m http.server
  • Go to http://:7070 on computer 2:


Thanks.
Next Post Previous Post
No Comment
Add Comment
comment url