SCP front-end script (for nautilus)

Hi there guys and gals! I’ve been working on a script and I’d like to share it with you. It’s meant to be a front-end for scp using Zenity. I’m looking forward for your comments on it! Zee ya!
Ok.. ***UPDATE*** BUGS FIXED!
Someone on #ubuntu-br gave me a great idea, to make it a nautilus script, so it’d be even more intuitive, and so i did it, have fun :D
P.S.: and now it even supports multiple file transferring!! \o/
#!/bin/sh
# SCP front-end script
# Created by R. C. Brandão (rcbrandao@gmail.com)

# Default options
port=22
user=ruy
dir=/home/ruy

# First, select the file…
com1=`echo $NAUTILUS_SCRIPT_SELECTED_URIS |sed ‘s@file://@@g’`
if [ -n "$com1" ]
then
# Second, select where the file is going to…
com2=`zenity –entry –title=”Where to ?” –text=”Type in the IP addy”`
if [ -n "$com2" ]
then
zenity –info –text=”Selected ip address is $com2″
zenity –info –text=”Sending over the selected file(s)…”
xterm -e scp -P “$port” ${com1} “${user}”@”${com2}”:”${dir}”
exit
else
# Set the receiver’s username and host as well as file’s destination and SSH port (manually)
zenity –warning –text=”No IP addy has been entered, attempting manual configuration”
fi
uhd=`zenity –entry –title=”There you go…” –text=”Syntax: username@host:destination”`
if [ -n "$uhd" ]
then
port1=`zenity –entry –title=”Now, the port” –text=”What’s the destination’s SSH server port ?”`
if [ -n "$port1" ]
then
zenity –info –text=”Sending over the selected file(s) with these manually defined options: $uhd on port $port1″
xterm -e scp -P “$port1″ ${com1} $uhd
exit
else
zenity –info –text=”Sending over the selected file(s) with these options: $uhd on port $port”
xterm -e scp -P “$port” ${com1} $uhd
exit
fi
else
zenity –error –text=”Manual configuration failed. Exiting.”
exit
fi
else
zenity –error –text=”No file’s been selected. Exiting.”
fi

About these ads

7 thoughts on “SCP front-end script (for nautilus)

  1. Will come in handy (after some customization), thanks.

    But PLEASE, god please, give a link to a file, or use pastebin or something. Have you ever tried copying, pasting, and running this stuff? Let me tell you: It won’t work, because this awful blog site called wordpress converts every quotation and double dash to unusable “pretty” equivalents (not to mention it being unreadable because of the stripped tabs).

  2. You can also use I guess to avoid the wrath of wordpress.

    Here is an improved version, that remembers last entered destination, i.e. "address:[path]", removes some unnecessary info dialogs, etc: scp-to

    Installation instructions:
    Save it under ~/.gnome2/nautilus-scripts/
    And run this to make it executable:
    chmod +x ~/.gnome2/nautilus-scripts/scp-to

  3. ALL HAIL THE OPEN SOURCE WHOOOAAAA \o/ \o/

    @Cornelius
    Yo dude! I’m taking a look at what you’ve done to the script and I really like it. It looks more pro now! haha! I wanted a progress bar on this thing however I couldn’t work out how to do so. Funny that I’d already given up working on this bit quite a long time ago after I realized nautilus is able to do the trick in an easier manner. Anyway.. I’m glad you liked my first [and last so far] attempt on shell scripting. I will be very glad to know about any updates :D

    Thanks for visiting,
    Cheers!

    • Brilliant! I’m no longer working on this, however I’ve taken a look at your blog post and it looks very promising. Way to go! :) I’m currently using plain nautilus (ssh://desired_ip_addy) to handle file transfers between PCs on my network. I still think using that and the concepts of my script altogether would provide a quicker solution to file transfering, if only I knew python *sigh*. Thank you for your comment though.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s