This is one of the features that has been removed from Nautilus File Manager (Files) by the Gnome Devs.
This is also problematic because while you can right click and send to trash, you can also drag and drop to trash.
I have just written and tested three different scripts included in the summary below... and not a single one worked in Nautilus.
Summary
#!/bin/bash
destination_directory="$2"
if [ "$destination_directory" == "~/.local/share/Trash/files" ]; then
read -p "Are you sure you want to move $1 to the trash? (y/n) " answer
if [ "$answer" == "y" ]; then
/bin/mv "$1" "$destination_directory"
echo "File moved to trash."
else
echo "Operation canceled."
fi
else
/bin/mv "$1" "$destination_directory"
echo "File moved to $destination_directory."
fi
#!/bin/bash
destination_directory="$2"
if [ "$destination_directory" == "~/.local/share/Trash/files" ]; then
read -p "Are you sure you want to move $1 to the trash? (y/n) " answer
if [ "$answer" == "y" ]; then
/bin/mv "$1" "$destination_directory"
echo "File moved to trash."
else
echo "Operation canceled."
fi
else
/bin/mv "$1" "$destination_directory"
echo "File moved to $destination_directory."
fi
#!/bin/bash
destination_directory="$HOME/.local/share/Trash/files"
if zenity --question --text="Are you sure you want to move $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS to the trash?"; then
mv "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" "$destination_directory"
zenity --info --text="File moved to trash."
else
zenity --info --text="Operation canceled."
fi
You might have more luck trying them... You will need to name the file and save it in a place (I used trash-confirm.sh), make it executable, and then set the path to that location for move using a symlink:
That being said, I use Nemo File manager and under Preferences > Behavior > Trash there is a checkbox for "ask before moving files to trash"
I clicked that, then tested it: Worked perfectly.
So using Nemo File Manager might be an option for you.
sudo apt install nemo
NOTE: if you want the version Nemo 5 (which includes a newer better search ability), follow this post on how to install it. Be sure to remove the repository once you install Nemo. You Must Remove The Repository before doing anything else.
I think GNOME team removed the removal confirmation because on Nautilus preferences on the Behavior section they set 2 trash bin options that prevent a definitive file deletion, that are confirming trash bin emptying and showing a request for definitive deletion. This way you both make order on your folders by moving files to the trash bin immediately without an additional request and even be sure that you can restore files if you need them again.
If your using Zorin Core (Gnome), first open the "Rubbish Bin" directory.
Next click the "Hamburger" Icon in the top right hand corner & select "Preferences", on the prefernce page click "Behaviour" at the top.
Then place a tick in the "Ask Before emptying the rubbish bin"
Hope this helps.