First here are two versions of a script that move all selected files into a new folder.
Versions 1 which will ask for the new folder-name:
#!/bin/bash
# Define a function that launches the zenity input dialog
get_foldername(){
zenity --entry --width=300 --title="Create New Folder" --text="Enter the new name:"
}
# Ask user for foldername
foldername=$(get_foldername) || exit
# Try to create a new folder with the name from user input
errorString=$( mkdir "$foldername" 2>&1 )
# If an error occurs show error dialog and ask again for foldername
while [ -n "$errorString" ]; do
zenity --error --title="$( echo $errorString | cut -d: -f3- )" --text="$( echo $errorString | cut -d: -f2- )" || exit
# Ask again for foldername
foldername=$(get_foldername) || exit
errorString=$( mkdir "$foldername" 2>&1 )
done
# Move selected files to the new folder
mv -t "${PWD}/${foldername}" "${@}"
Versions 2 which will paste the files in a new folder and names him with current date:
#!/bin/bash
foldername=$( echo `date +%Y-%m-%d`"-"`date +%H%M%S` )
# Try to create a new folder with the current date and time
errorString=$( mkdir "$foldername" 2>&1 )
if [ -n "$errorString" ]; then
zenity --error --title="$( echo $errorString | cut -d: -f3- )" --text="$( echo $errorString | cut -d: -f2- )"
exit
fi
# Move selected files to the new folder
mv -t "${PWD}/${foldername}" "${@}"
Save the script (or both but in different files) in the directory $HOME/bin
call it something like this move-to-new-folder.sh
and make it executable:
Now we have to add the scripts to Thunar.
There a two possibilities to add scripts to the right click menu of Thunar (as far as I know):
Send to method:
Create a folder $HOME/.local/share/Thunar/sendto
Create a file in this new folder and call it move-to-new-folder.desktop
Content of the file:
[Desktop Entry]
Type=Application
Version=1.0
Encoding=UTF-8
TryExec=/home/username/bin/move-to-new-folder.sh
Exec=/home/username/bin/move-to-new-folder.sh %F
Icon=/usr/share/icons/elementary-xfce/actions/48/folder-move.png
Name=New Folder
3. Make the file executable
More info: http://docs.xfce.org/xfce/thunar/send-to
Custom actions method:
More info: http://docs.xfce.org/xfce/thunar/custom-actions