View Full Version : Create "move to home folder" item in context menu?
loclarkey
March 15th, 2007, 10:56 PM
Hi, this may be in the wrong section, but I have a feeling that the solution involves a bash script that I won't be able to come up with on my own. How can you add a "Move item to home folder" item in the right-click context menu on the desktop?
Ubuntu Edgy 6.10
Gnome 2.16.1
Ramses de Norre
March 15th, 2007, 11:26 PM
You can in the scripts menu, but getting it in the first menu will require you to hack on the source...
You can put this in ~/.gnome2/nautilus-scripts/ and set it executable.
#!/bin/bash
cd $NAUTILUS_SCRIPT_CURRENT_URI
for I in "$*"
do
mv -i "$I" /home/`whoami`/
done
loclarkey
March 16th, 2007, 01:35 AM
Thank you, Ramses.
Mr. C.
March 16th, 2007, 04:02 AM
What the heck is that for loop doing, when it exits the first time? Are you trying to get the first argument ?
Why not use $HOME instead of that /home/`whoami` ?
Hmmm...
MrC
sas
March 18th, 2007, 04:31 AM
What the heck is that for loop doing, when it exits the first time? Are you trying to get the first argument ?
There might be more than one files selected. so it iterates through the selection.
Mr. C.
March 18th, 2007, 05:31 AM
Not with that exit 0 there.
Ramses de Norre
March 18th, 2007, 12:34 PM
Ow that exit line shouldn't be there, sorry.
Mr. C.
March 18th, 2007, 06:06 PM
Right, exactly.
Now, since mv takes multiple arguments, why not ditch the for loop entirely and do:
mv files .... directory
MrC
Powered by vBulletin® Version 4.2.2 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.