Subscribe to the RSS Feed

Paradox - a statement or proposition that seems self-contradictory or absurd but in reality expresses a possible truth.

:: BINARY PARADOX ::

Stepping stone to the /dev/null in the sky

Nautilus SCP

I don’t know about you, but I find myself using SCP quite frequently to transfer files from my laptop to my server. It’s almost always from one specific code folder to another, and almost always to this one particular machine. I enjoy the flexibility of having two separate folders, and rsync seems like overkill. I’m happy with the minimal configuration setup I have. Much of this happiness is due to a bash script I wrote and used to extend the gnome file browser: nautilus. This script can be activated on any number of files just by selecting them in the GUI, right clicking and choosing to invoke it. Very handy!

Once you have selected the files and invoked the script, it will pop up a dialog box up asking you what the destination folder on the target machine is. After transferring the files there, it will then pop up an additional message telling you the success or failure of each of these file transfers (based on the exit code of the scp command).

This script relies on the ‘gmessage’ package being installed. If you are hesitant to install additional binaries on your machine then it is quite trivial to replace the gmessage calls with calls to ‘xmessage’. A more commonly available package with an almost identical syntax but a much more basic output style.

This script is also best paired with public key authentication. Otherwise this script isn’t all that useful as you’ll have to log into the target box before the transfer can happen.

file: scpCopy.sh [541.00B]
Category: scripts
download: 45

You’ll need to mod the script a little to make it specific to your needs. Change user, machine and defaultDir and you’ll be all set. Save the script with your changes as “sendToMachine.sh” or something similar. You’ll then need to chmod +x the file to give it executable permission. Alternatively if you’d prefer to stay away from the command line, you can right click the script, click the “Permissions” tab and click the “Allow executing this file as a program” checkbox.

Once you’ve got the file saved and set to be executable, all you have to do is drop it into the nautilus scripts folder. On my machine that was “~/.gnome2/nautilus-scripts/”. If you are browsing there with nautilus don’t forget to turn on “Show Hidden Files” under the “View” menu, otherwise the .gnome2 folder will not appear as it is hidden.

You’re done! The script is now accessible from right clicking files, choosing “scripts” and selecting the filename you saved your script in.


Transmissions:

  1. If you remove the loop, you can send several files without it asking for a password each time.

    Ubersoldat · Jan 18, 09:03 AM · #

  2. I assume you mean by squashing the script args right into the scp command? That would certainly work.

    It never occurred to me because of the way I had my public key authentication set up. I didn’t have to deal with multiple password prompts.

    Good suggestion. I will have to experiment. I’m finding myself using this script a lot less these days however.

    (Also, sorry for the moderation delay).

    - Dan

    Daniel · Jan 31, 05:01 PM · #

Begin Transmission:

Add your thoughts, preview and then submit

Please note, your comment will not appear until after it has been moderated & approved. Sorry!


Hidden


Textile Help

You may also be interested in...