Friday, April 29, 2011

Transferring music between computers

I work with quite a few computers, all on the same LAN, and often find a need to copy music (or whatever other files) from one machine to another.
The traditional way to do this is with scp which means running this command in the client computer:

scp -r username@192.168.x.y:/path/to/folder/on/server/ /path/to/receiving/folder/on/client/

where 192.168.x.y is the IP address of the server.
You can issue a similar command from the server as follows:
scp -r /path/to/folder/on/server/ username@192.168.a.b:/path/to/receiving/folder/on/client/

where 192.168.a.b is the IP address of the client.
This works fine and very quickly.
However, I find that, on my system at least, that the sound quality of transferred music can be much inferior in places. Why this should be, I really don't know nor have I investigated if this is a known and wide-spread problem or not.
Anyway, I was interested to try some other means of transfer to see if the sound quality could be preserved.
I have, for a long time, used the Python SimpleHTTPServer and like it a lot.
One downside, however, is that to download a music folder using only the browser on the client means individually downloading each file which can become very tedious.
However, the wget function works well to get over this problem.
After setting up the Python server on the server side, run this command on the client
wget -r 192.168.x.y:8000/path/to/folder/on/server/
where 192.168.x.y is the server IP address and 8000 is the default python server port (which may be easily changed on the server side).
This command downloads the required files very quickly to a created directory tree rooted in the directory from which the wget command was run.
The directory tree starts with a folder called 192.168.x.z:8000 followed by the subdirectory tree corresponding to /path/to/folder/on/server/.
By adding (at the end of the command) "--directory-prefix=/desired/receiving/directory/on/client/, the wget command will direct the downloaded directory tree+files to the desired directory.
However, I was unable to discover how to avoid getting that tiresome directory tree on the client. I only want the files directed to a chosen folder.
Of course, by running the python server from the exact folder containing the files to be transferred, almost all of the unneeded directory tree can be avoided. However, the transferred files are still contained with a sub-folder named 192.168.x.y:8000 within the target directory as specified by the --directory-prefix=/desired/folder/on/client/.
Still, the quality of music files transferred using the python server and the wget command is far superior to that afforded by the scp transfer on my system.

No comments:

Post a Comment