Friday, April 08, 2011

The real power of the scp command for file and folder transfer

I've talked a lot about the python SimpleHTTPServer in this blog and it's great for quickly transferring single files (of whatever size) between computers.
However, where it falls down is in transferring folders between computers simply because each file in the folder must be individually downloaded.
This can be a real pain if you need to bring over gigabytes of music.
In this circumstance, a far more powerful tool is the scp command.
The other day, I transferred an awful lot of music from my Mac to Ubuntu using, in Ubuntu, this command

$ scp -r *mac_account_username*@192.168.1.X:Desktop/*name_of_music_folder* Music

where information between two * must be substituted with real values. Note that I transferred from ~/Desktop on the Mac to ~/Music in Ubuntu.
The X in the IP is just to indicate that the real LAN IP of the source computer must be inserted.
The transfer was very rapid reaching 17 MB/s for larger files.

Once I had moved everything from the Mac to the ~/Music folder in Ubuntu, I could now import everything rapidly to my Banshee media player. Banshee finds cover art for (nearly) all albums and can identify albums if just the individual songs are added.
Any errors that might be made here can be easily rectified by editing using the Edit Track Information facility (from song context menu).

One relatively minor problem I had with the scp command in in handling file/folder names which contained spaces such as "file name".
The scp command could not identify it as a filename with a space whether I denoted it as "file name" or as file\ name.
After much trial and error (a lot more error than trial, actually), the only successful expedient was to rename the troublesome files and folders on the Mac to something like filename.

No comments:

Post a Comment