So for all those people who have always been Windows users and now want to move to Linux, there are some things which we miss a lot in Linux or want in Linux.

The “Send To” menu is one of them. I used to miss it a lot as well, but not anymore. I wrote a Nautilus Script to add the “Send To” menu to my Nautilus right click menu.

Here’s the steps to get your own custom “Send To” menu item in Nautilus :

First of all move to the following folder

                                $cd ~/.gnome2/nautilus-scripts

Then create a file in this folder and name the file whatever you want your menu item to be

                                $touch “Send To”

Add the execute permission for this file

                                $chmod +x “Send To

Edit this file and add the following code in this file

                                #!/bin/bash
                                ## Authur : Sushant Bhosale <sushantbhosale91@gmail.com>
                                IFS=$’\n’
                                cd ~/
                                gnome-terminal –command=’./list.sh’
                                exit 0

Now go to the home directory and create a file named “list.sh” and add execute permission to it

                                $cd ~/

                                $touch list.sh

                                $chmod +x list.sh

Edit “list.sh” and add the following code in the file

                                #!/bin/bash
                                ## Author : Sushant Bhosale <sushantbhosale91@gmail.com>
                                IFS=$’\n’
                                cd /media/
                                array=(`ls`)
                                len=${#array[*]}
                                i=0
                                while [ $i -lt $len ]; do
                                                                echo “$i: ${array[$i]}”
                                                                let i++
                                done
                                echo “Enter the folder to copy: “
                                read ch
                                for FILENAME in $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS
                                do
                                                                cp $FILENAME /media/${array[$ch]}
                                done
                                exit 0

Just save and copy with just few clicks. . .

Another good feature of this script is that it asks the user for the drive to copy file to, so you can use it to copy file to any mounted drive.

The reason for using two scripts is that nauitilus-script runs in background instead of in a terminal, but we needed the user input in this case so had to use two scripts.

I’ll upload the files here for downloading, link at the bottom of the post.

"Send To" in Right Click

Enter the Drive to copy the file into.

Note : WordPress won’t allow me to upload .txt or .sh file so I changed the extension to .doc, just change it back to .sh prior to downloading.

Here’s the link for “Send To” file. Rename this file from “Send To.doc” to “Send To”

Here’s the link for “list” file. Rename this file from “list.doc” to “list.sh”.

Advertisements

Comments on: "“Send To” script for Nautilus in Ubuntu" (6)

  1. Why are you running these commands as root (#)??

    • I don’t like to use sudo and enter password all the time.

      • Yes but these commands do not need sudo or su. This is a script in your /home directory, why would you want to run this as root? Gnome should never be ran as root but you put your scripts in # ~/.gnome2/nautilus-scripts which would mean your script goes into /root/.gnome2/nautilus-scripts which would only run if you were logged into Gnome as root.

      • I just wrote ‘#’, just for the sake of it. I didn’t actually run it as root. I’ll amend it to ‘$’. Thanks for pointing it out.

      • No problem. The reason I pointed it out was that one of the users of the forum I admin was following your directions and was having issues.

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

%d bloggers like this: