Share on Dropbox - Nautilus Script

To install this script just download the file , place it under your home ~/.gnome2/nautilus-scripts , make it executable and then kill nautilus. Below are copy&paste instructions to install from terminal

cd ~/.gnome2/nautilus-scripts  
wget "http://www.andreaolivato.net/Share on Dropbox"  
chmod 755 "./Share on Dropbox"  
killall nautilus

Please note that I manage duplicate files adding an incremental number to the name, after the full name (yep the extension too)
Below is the full source of the script, which is released under GPL v3 licence

#!/bin/bash  
# Share on Dropbox
# Nautilus Script to share files or folder in one click
# Copyright (C) 2010  Andrea Olivato "andrea@olivato.me"
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see gnu.org/licenses/.

if [ -n "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" ]  
then  
    files=( $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS )
    for (( i=0; i<${#files[@]}; i++ ))
    do
        fileorfolder=`echo ${files[$i]} | awk '{split($0,a,"/"); print a[length(a)]}'`
        if [ -f ~/Dropbox/$fileorfolder ]
        then
            OK=0;
            N=0;
            while [ $OK -lt 1 ]
            do
                if [ -f ~/Dropbox/${fileorfolder}${N} ]
                then
                    (( N++ ))
                else
                    fileorfolder=${fileorfolder}${N};
                    OK=1;
                fi
            done
        fi;
        mv ${files[$i]} ~/Dropbox/$fileorfolder
        ln -s ~/Dropbox/$fileorfolder ${files[$i]}
    done
else  
    NAUTILUS_SCRIPT_CURRENT_URI=${NAUTILUS_SCRIPT_CURRENT_URI/file:\/\//}
    fileorfolder=`echo $NAUTILUS_SCRIPT_CURRENT_URI | awk '{split($0,a,"/"); print a[length(a)]}'`
    if [ -f ~/Dropbox/$fileorfolder ]
    then
        OK=0;
        N=0;
        while [ $OK -lt 1 ]
        do
            if [ -f ~/Dropbox/${fileorfolder}${N} ]
            then
                (( N++ ))
            else
                fileorfolder=${fileorfolder}${N};
                OK=1;
            fi
        done
    fi
    mv $NAUTILUS_SCRIPT_CURRENT_URI ~/Dropbox/$fileorfolderg
    ln -s ~/Dropbox/$fileorfolder $NAUTILUS_SCRIPT_CURRENT_URI
fi

This idea is not original, I took inspiration from the "Share on UbuntuOne" of ubuntu 10.4 and DropboxFolderSync for windows

Andrea Olivato