[SOLVED] 'Move To' & 'Copy To' menus?

Forum rules
Before you post please read how to get help
Post Reply
RiverRanch
Level 1
Level 1
Posts: 40
Joined: Tue Oct 18, 2016 9:30 am

[SOLVED] 'Move To' & 'Copy To' menus?

Post by RiverRanch » Sun May 12, 2019 6:18 am

Why do the 'move to' & 'copy to' menus only show the 'desktop' or 'home folder' as options? Why not any attached peripherals such as hd's or thumb drives etc....?
Any way to make it so any attached peripherals show in these two options?
Thanks
menu.jpg
menu.jpg (41.47 KiB) Viewed 464 times
Last edited by RiverRanch on Sun May 19, 2019 5:11 am, edited 1 time in total.
Linux Mint Mate 19.

User avatar
Flemur
Level 16
Level 16
Posts: 6933
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: 'Move To' & 'Copy To' menus?

Post by Flemur » Sun May 12, 2019 11:25 am

RiverRanch wrote:
Sun May 12, 2019 6:18 am
Any way to make it so any attached peripherals show in these two options?
Open them in the "Other pane".
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
Mint 19.1 Xfce/fluxbox
Manjaro openbox/fluxbox

User avatar
smurphos
Level 11
Level 11
Posts: 3732
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher
Contact:

Re: 'Move To' & 'Copy To' menus?

Post by smurphos » Tue May 14, 2019 1:54 am

The contents of the move to & copy to menu options appear to be hardcoded in Caja - /usr/share/caja/ui/caja-directory-view-ui.xml.

This differs from example from nemo in Cinnamon where it populates from the user's bookmarks and also includes a browse option.

Image
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.

RiverRanch
Level 1
Level 1
Posts: 40
Joined: Tue Oct 18, 2016 9:30 am

Re: 'Move To' & 'Copy To' menus?

Post by RiverRanch » Sat May 18, 2019 8:21 am

smurphos wrote:
Tue May 14, 2019 1:54 am
The contents of the move to & copy to menu options appear to be hardcoded in Caja - /usr/share/caja/ui/caja-directory-view-ui.xml.

This differs from example from nemo in Cinnamon where it populates from the user's bookmarks and also includes a browse option.

Image
Thanks.
So I'm stuck with it the way it is?
Linux Mint Mate 19.

gm10
Level 17
Level 17
Posts: 7448
Joined: Thu Jun 21, 2018 5:11 pm

Re: 'Move To' & 'Copy To' menus?

Post by gm10 » Sat May 18, 2019 9:48 am

RiverRanch wrote:
Sat May 18, 2019 8:21 am
So I'm stuck with it the way it is?
Either install and use Nemo as shown in smurphos' example or modify your Caja. The simplest way for doing the latter is adding a user script (copy & paste as a whole into a terminal window and press Enter):

Code: Select all

F=~/.config/caja/scripts/Copy\ to
cat > "$F" <<'EOB'
if [ ! -z "$1" ]; then
  dest=$(zenity --file-selection --directory --title="Choose Target Directory ${@}")
  for filename in $@; do
    if [ -e "${dest}"/"${filename}" ]; then
      zenity --question --ellipsize --title="Target File Exists" --text="'${filename}' already exists in target directory.\n\nReplace?"
      if [ $? -ne 0 ]; then
        continue
      fi
    fi
    cp "${filename}" "${dest}"
    if [ $? -ne 0 ]; then
      zenity --error --ellipsize --title="Error" --text="'${filename}' could not be copied."
    fi
  done
fi
EOB
chmod a+x "$F"
If this is your first user script then this adds a Scripts entry to Caja's right-click menu, where you'll now find a Copy To option. Unlike the regular Copy To option you won't get GUI feedback from this one (could be added to the script but personally I don't care about that - if you google I'm sure someboyd else has scripted something like that already).

If that works for you, here's the same as a Move To option:

Code: Select all

F=~/.config/caja/scripts/Move\ to
cat > "$F" <<'EOB'
if [ ! -z "$1" ]; then
  dest=$(zenity --file-selection --directory --title="Choose Target Directory ${@}")
  for filename in $@; do
    if [ -e "${dest}"/"${filename}" ]; then
      zenity --question --ellipsize --title="Target File Exists" --text="'${filename}' already exists in target directory.\n\nReplace?"
      if [ $? -ne 0 ]; then
        continue
      fi
    fi
    mv "${filename}" "${dest}"
    if [ $? -ne 0 ]; then
      zenity --error --ellipsize --title="Error" --text="'${filename}' could not be moved."
    fi
  done
fi
EOB
chmod a+x "$F"
If you want to remove or rename the script options, you'll find them in this location: ~/.config/caja/scripts/.

Note that for more control over the menu placement (i.e. if you don't want them in a Scripts submenu) you can install caja-actions and run the scripts through that instead. I'll leave the details of that as an exercise to the reader. ;)
Last edited by gm10 on Sun May 19, 2019 5:21 am, edited 1 time in total.

RiverRanch
Level 1
Level 1
Posts: 40
Joined: Tue Oct 18, 2016 9:30 am

Re: [SOLVED] 'Move To' & 'Copy To' menus?

Post by RiverRanch » Sun May 19, 2019 5:11 am

Thank You. Works perfectly.
Linux Mint Mate 19.

Post Reply

Return to “MATE”