this script is suppsed to be started in a folder full of images that need sorting.

(it is even possible to ssh -X into a machine and do this remotely)

# requirements
su - root
apt update
# install simple but effective picture viewer :)
apt install sxiv

# create the subfolders
cd /path/to/images
mkdir SUBFOLDER1 SUBFOLDER2 delete

# create the script
vim /scripts/sort.pics.sh

#!/bin/bash
echo "=== basic script that helps with sorting images ==="
echo "0. requirements: install sxiv simple image viewer"
echo "1. ssh -X connect to server with images stored"
echo "cd /in/the/folder/of/the/pictures"
echo -e "start the script\n"

# iterate over all files in the current directory
for file in *;
do
sxiv "./$file" &

clear;

echo -e "... currently processing file: $file\n"

echo "what to do with that file?"
echo "1) sort to: SUBFOLDER1"
echo "2) sort to: SUBFOLDER2"
echo "d) delete"
echo -e "hit enter to skip to next file\n"

echo -e "Enter 1 2 or d\n"
read DECISION

pkill sxiv;

if [ "$DECISION" = "1" ];
then
echo -e "... moving file $file to subfolder SUBFOLDER1 ...\n"
mv -v /path/to/images/$file /path/to/images/SUBFOLDER1/
fi

if [ "$DECISION" = "2" ];
then
echo -e "... moving file $file to subfolder SUBFOLDER2 ...\n"
mv -v /path/to/images/$file /path/to/images/SUBFOLDER2/
fi

if [ "$DECISION" = "d" ];
then
echo -e "... moving file $file to subfolder delete...\n"
mv -v /path/to/images/$file /path/to/delete/
fi
sleep 1

echo -e "... moving to next file ....\n"
done

start the script and happy sorting 🙂

only drawback:

whenever sxiv starts, it gets in the foreground, needing an Alt+Tab to get back to terminal and enter 1, 2 or d
but still: this is way faster process than

1. open the picture

2. save as… or find filename and move to

3. next picture

when done… look again through the delete folder (the trash) and then delete the folder

man page of sxiv:

sxiv.man.txt

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin