How to use nautilus scripts to make a "send to [folder]" right-click option
I've just been trying to come up with a workaround for nautilus's somewhat hobbled "Send to" option in order to let you specify a particular folder that you often send things to (e.g. as people in this (archived) thread were trying to do).
Solution: Use nautilus scripts.
- Open up ~/.gnome2/nautilus-scripts
- Create a new empty file, and give it executable permissions (right-click, properties, 'permissions' tab)
- Open the file, and paste the following code in:
Code:
#!/bin/bash
FILES=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##)
eval "mv -u -t /home/simon/Music/ $FILES"
exit
- Replace "/home/simon/Music/" with whatever folder you want to be able to move things to easily (remembering to escape spaces, e.g. "/my\ folder/" rather than "/my folder/")
- Rename the file to "Move to my folder" (or something)
"Move To My Folder" will now be on the right-click menu in Nautilus, under "scripts".
(Credit to http://g-scripts.sourceforge.net/faq.php for the awk & sed code that lets it handle multiple files & files with spaces).
Be careful with sudo! The most damage you can do when not root is destroy your life's work, which should be reconstructable in mere decades; wheras running as root you could damage Ubuntu itself, requiring a reinstall which takes up to half an hour!
Bookmarks