HTTP for Large File Transfers on Local Network

Write tutorials here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Please don't add support questions to tutorials,start your own thread in the appropriate sub-forum instead. Before you post please read this
Post Reply
altair4
Level 19
Level 19
Posts: 9687
Joined: Tue Feb 03, 2009 10:27 am

HTTP for Large File Transfers on Local Network

Post by altair4 » Mon Jul 08, 2013 10:42 am

HTTP for Fast Large File Transfers on Local Network

BACKGROUND:
I purchased a new PC months ago and wanted to transfer some VBox virtual machines from the old machine to the new one. These are very large files and the the problem was the usual means of transferring them presented problems. Samba, SSH, ftp, even TransferOnLan were either excruciatingly slow or broke connections during the transfer.

After an hour or so of my repeated profanity my wife ( who is a software developer ) suggested that I create a temporary HTTP server on the old machine and use an Internet browser or wget or axel or whatever on the new machine to download them. There's a built in python module to do all that for you and she bet that a Linux desktop would have python already installed.

It ... ahem ... does indeed:


[] Creating a temporary read only HTTP server:

** Change directories to the parent folder of the files you want to transfer:

Code: Select all

cd /path/to/parent/folder
** Then run the following command:

Code: Select all

python -m SimpleHTTPServer
Note: In Python3 SimpleHTTPServer has been replaced by http.server so the command would be:

Code: Select all

python -m http.server
** On the client open a browser and enter the location of the server in one of the following formats:

Code: Select all

http://192.168.0.100:8000
http://hostname:8000
http://hostname.local:8000
Replacing 192.168.0.100 or hostname with their real values.

If you happen to have an index.html file in that directory then only that will be seen but if you don't the client will see a list of the contents of that directory expressed as links.

** After the files have been transfered close the temporary HTTP server by issuing a Ctrl+C in the terminal.

I poked around a bit and found a script that uses the above python module and extends it's function to allow uploads to the directory for those that are interested. It takes a bit to get this set up but it may be of interest.

[] Creating a temporary HTTP server with upload capability:

** Click on the Download Gist button here: https://gist.github.com/UniIsland/3346170
** Then extract it to your Downloads folder.

It has a rather cumbersome path so invoking it through that path is too much trouble. You could create an alias or symlink I suppose but I did it another way:

** Create a /bin directory in your home folder:

Code: Select all

mkdir ~/bin
** Copy the script to that directory. In my case it was something like this:

Code: Select all

cp ~/Downloads/gist3346170-059aca1d510c615df3d9fedafabac4d538ebe352/SimpleHTTPServerWithUpload.py ~/bin
** Make the file executable

Code: Select all

chmod +x ~/bin/SimpleHTTPServerWithUpload.py
** Logout and login again so the system knows you now have your own /bin directory.

To use this script:

** Change directories to the parent folder of the files you want to transfer:

Code: Select all

cd /path/to/parent/folder
** Then run:

Code: Select all

SimpleHTTPServerWithUpload.py
** On the client open a browser and enter the location of the server in one of the following formats:

Code: Select all

http://192.168.0.100:8000
http://hostname:8000
http://hostname.local:8000
Replacing 192.168.0.100 or hostname with their real values.

** After downloading or uploading is done kill the temporary server by invoking: Ctrl+C

Note: Both methods are meant to be temporary set ups and not intended to be a replacement for other file sharing protocols.
Please add a [SOLVED] at the end of your original subject header if your question has been answered and solved.

Post Reply

Return to “Tutorials”