Share files over local network

Share files over local network

Share current working directory in local network using Python

Requirement

User has to install python 2 or python 3 in his/her system. Please download and install python in your system before moving into next section. Two different sections are provided for python 2 and python 3. Please follow appropriate section according to your python version.

Share files using Python 2.7

Python Simple HTTP Server library

We can use SimpleHTTPServer to turn any directory into a HTTP web server. This is built-in library in python 2.7. This supports only two HTTP methods - GET and HEAD.

Steps:

  1. Go to your required folder (the files and directories inside will be visible) of hosting computer and open terminal/commandline there
  2. Run command python -m SimpleHTTPServer <ANY_PORT_NUMBER>
    • Example: python -m SimpleHTTPServer 9000
    • The default port number is 8000 if not provided. It is recommended to give unique port number to avoid conflicts
  3. Please notedown the IP address and port number of the hosting system as this will be required by other systems to access shared location. Commands to check IP address are given below:
    • Windows: ipconfig
    • Linux: ifconfig
  4. In other system, open a web browser and type given syntax in address bar: <IP_ADDRESS>:<PORT_NUMBER>
    • Example: 172.24.188.199:9000 where 172.24.188.199 is IP address of hosting system and 9000 is port number
  5. You can access files in same system by writing localhost instead IP address
    • Example: localhost:9000

Share files using Python 3

  1. We will use http.server module
  2. Run command py -m http.server <ANY_PORT_NUMBER>
    • Example: py -m http.server 9000
    • The default port number is 8000 if not provided. It is recommended to give unique port number to avoid conflicts
  3. Please notedown the IP address and port number of the hosting system as this will be required by other systems to access shared location. Commands to check IP address are given below:
    • Windows: ipconfig
    • Linux: ifconfig
  4. In other system, open a web browser and type given syntax in address bar: <IP_ADDRESS>:<PORT_NUMBER>
    • Example: 172.24.188.199:9000 where 172.24.188.199 is IP address of hosting system and 9000 is port number
  5. You can access files in same system by writing localhost instead IP address
    • Example: localhost:9000