Posts tagged ‘Custom’

“Send To” script for Nautilus in Ubuntu

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