Move to .. , Copy to .. in Caja

Okay after a couple of minutes playing around, I’ve done a proof of concept for creating a simple Copy to Caja-Action. I’ve deliberately kept it simple to and encourage you to tailor it to your needs.

The script is very simple:

#!/bin/bash
OUTPUT=$(zenity --file-selection --directory --title="Choose your destination")
TARGETDIR=$(awk -F, '{print $1}' <<<$OUTPUT)
cp "$1" "$TARGETDIR/"

To create the Caja-Action:

  1. Save the script file as /home/username/bin/copy_to.sh and make it executable.
  2. Open the Caja-Actions Configuration Tool
  3. Create a new action
  4. Under the Action tab, give your action a Context label i.e. ‘Copy to…’
  5. Under the Command tab, enter the path (i.e. /home/username/bin/copy_to.sh) to your script and enter %f in the Parameters field

To use the action:

  1. Right-click the file you want to copy and select Caja-Actions actions -> Copy to
  2. In the popup window, select the directory you wish to copy the file to and click OK
  3. The file will be copied

Customisation and refinement

This is a barebone proof-of-concept only. Feel free to edit the script to suit your needs, for example, copying multiple files, creating a Move to version, checking if a file already exists in the target directory etc…

3 Likes