Transfer files from laptop to mobile using Python
Sahil Rajput

Sahil Rajput @sahilrajput

About: just another programmer...

Location:
New Delhi
Joined:
Nov 1, 2018

Transfer files from laptop to mobile using Python

Publish Date: Nov 6 '18
131 18

If you think that you need some fancy applications to tranfer files from your laptop/computer to mobile, than you are wrong.
All you need is Python

NOTE: Your laptop and your mobile phone should be on same network

Let's get started

Open your terminal and execute this command.
If you are using Python3:

python -m http.server
Enter fullscreen mode Exit fullscreen mode

If you are using Python2:

python -m SimpleHTTPServer
Enter fullscreen mode Exit fullscreen mode

When you will execute this command it will create a HTTP server on your local machine.
screenshot 2018-11-06 at 4 45 57 pm

Type <IP_Address>:8000 in your mobile browser to access the files in the directory where you ran the above command.


If you don't know your IP than follow this steps:
Go to System Preferences -> Network-> You will see your IP address there


Suppose your IP address is 192.168.0.1 then open mobile browser and type 192.168.0.1:8000 to access the files.
screenshot 2018-11-06 at 5 25 05 pm

Comments 18 total

  • Sergey Kislyakov
    Sergey KislyakovNov 6, 2018

    I saw an app that generates the QR code to access the file over LAN. I don't remember the name, but I think it's not that hard to write your own. That would be much simpler to get the file rather than typing 192.168.whatever in your browser and then finding the file.

    • Sahil Rajput
      Sahil RajputNov 6, 2018

      I think that would be great.

      Thanks for the suggestion. I will soon post the complete program :)

    • HackerTon
      HackerTonNov 7, 2018

      Used to called bitsync but now ResillioSync. Hope that helps.

  • Christoph Rissner
    Christoph RissnerNov 6, 2018

    What a great idea! Thanks!

  • ComputerSmiths
    ComputerSmithsNov 7, 2018

    If you are already in the terminal,

    ifconfig | grep ‘inet ‘

    Will show your IP. I’ve got it aliased to ‘lan’ in my .profile

  • Marko
    MarkoNov 7, 2018

    Nice hack, thanks 4 share!

  • ytjchan
    ytjchanNov 7, 2018

    What about transferring from mobile to laptop? Any tricks 😉?

  • Nelson Romero
    Nelson RomeroNov 8, 2018

    Is a great idea, works very fine to me. Thanks!

  • Tamara Temple
    Tamara TempleJan 21, 2019

    This is useful. For those who don't do python, ruby has something similar, as does perl. Chances are you have at least one of these on your system!

    Ruby: ruby -run -e httpd . runs a webserver in the current directory on port 3000.

    Perl: http_this same thing (you'd probably need to install App-HTTPThis first though)

    This is such a useful tool I made an alias for it!

  • Tamara Temple
    Tamara TempleJan 21, 2019

    Oh, this is almost diabolical in it's greatness! I never really think about getting files from my mobile, since I'm mostly always using google drive.

  • Sandeep
    Sandeep Jan 22, 2019

    github.com/sndp487/share-it

    This is for mobile to laptop. Provides a simple web UI.

  • Abdur-Rahmaan Janhangeer
    Abdur-Rahmaan JanhangeerMar 21, 2019

    could've included a py script to show ip address here

Add comment