Mar 5, 2009

Nautilus Scripts

Started from here, talked about Send To feature ( this feature is famous in Ms. Windows -- i think ) , i just realized that i have missed another simple thing !!
I found something in wiki and something in unleashed.

If you need Copy-To script :

#! /bin/bash
location=`zenity --file-selection --directory --title="Select a directory"`
for arg
do
if [ -e "$location"/"$arg" ];then
zenity --question --title="Conflict While Copying" --text="File ""$location"/"$arg"" already exists. Would you like to replace it?"
case "$?" in
1 ) exit 1 ;;
0 ) cp "$arg" "$location" ;;
esac
else
cp "$arg" "$location"
fi
done

If you need Move-To script :

#! /bin/bash
location=`zenity --file-selection --directory --title="Select a directory"`
for arg
do
if [ -e "$location"/"$arg" ];then
zenity --question --title="Conflict While Moving" --text="File ""$location"/"$arg"" already exists. Would you like to replace it?"
case "$?" in
1 ) exit 1 ;;
0 ) mv "$arg" "$location" ;;
esac
else
mv "$arg" "$location"
fi
done

just copy the script to your text editor and save it to
~/.gnome2/nautilus-scripts/

But, don't forget one more thing;
your script must be executable by typing
sudo chmod a+x ~/.gnome2/nautilus-scripts
in Terminal.

You can get Send-To script here
Open your Nautilus and the scripts will be there when you right-click on something ( press reload button if you didn't see any )

Done !!!
~E~

No comments: