Collecting filenames with Thunar
Sat 17 June 2017 by Stig Inge Lea BjørnsenOn my Linux desktop, I combine its graphical user interface (GUI) and command line interface (CLI).
The shell script collect-files.sh
is on my path and used for collecting
filenames.
It can be used from the command line:
$ collect-files.sh add /home/user/IMG_4453.JPG /home/user/IMG_4455.JPG
But, using the XFCE desktop environment with its Thunar file manager, I have added this script as a custom action.
By selecting files and choosing "Collect filenames" in the context menu I can preview files before I choose to collect them:
Using Thunar I can navigate into many folders and collect the files I need. When done, I can se what was collected:
$ collect-files.sh list
/home/user/IMG_4453.JPG
/home/user/IMG_4455.JPG
With this output, I can do anything with the collected filenames by using command line tools.
If I wanted to share copies of the collected files with other users, I would use the following one-liner:
$ collect-files.sh list | while read filename; do cp -v "$filename" /home/user/Public/; done
If you are interested, the script is available for
download. Store it in $HOME/bin
or any other
folder on your $PATH
. When added as a Thunar custom action its command line
should be collect-files.sh add %F
.