Copy To, Move to in Caja

@shahmoeen See here - Move to .. , Copy to .. in Caja I’ve changed the scripts minutely to improve them.

These scripts should be placed in .config/caja/scripts/ where they will be available on a right click of your file, Scripts>.

copy_to is as follows -

#!/bin/bash
numberArgs=$#

OUTPUT=$(zenity --file-selection --directory --title="Choose your target directory")

if [ "$?" -eq 1 ]; then
    zenity --error --text="Cancelled"
    exit 1
fi

TARGETDIR=$(awk -F, '{print $1}' <<<$OUTPUT)

 for (( i=1; i<=$numberArgs; i++ )); do
    echo "# ${1##*/}"
    cp -p -r "${1}" "$TARGETDIR/"
    echo "$(( (i * 100)/$numberArgs ))"
    sleep 0.5 
    shift 1
done | zenity --progress --title="Copy files to $TARGETDIR" --percentage=0

if [ "$?" -eq 1 ]; then
    zenity --error --text="Cancelled!"
    exit 1
fi

move_to is as follows -

#!/bin/bash
numberArgs=$#

OUTPUT=$(zenity --file-selection --directory --title="Choose your target directory")

if [ "$?" -eq 1 ]; then
	zenity --error --text="Cancelled"
# --auto-close
	exit 1
fi

TARGETDIR=$(awk -F, '{print $1}' <<<$OUTPUT)

for (( i=1; i<=$numberArgs; i++ )); do
	echo "# ${1##*/}"
	cp -r --preserve=all "${1}" "$TARGETDIR/"
	rm -r "${1}"
	echo "$(( (i * 100)/$numberArgs ))"
	sleep 0.5
	shift 1
done | zenity --progress --title="Copy files to $TARGETDIR" --percentage=0 
# --auto-close

if [ "$?" -eq 1 ]; then
	zenity --error --text="Cancelled!" 
# --auto-close
	exit 1
fi
2 Likes