qiv
supports custom operations on a file. You could e.g. use the script listed below. You'd have to save it is qiv-command
somewhere on your path,
and then you could rename the file by pressing 0
, and give the file a different prefix by pressing '1'.
#!/bin/sh
set -eu
case "$1" in
0)
# Rename file
DIR="$(dirname $2)"
FILE="$(basename $2)"
NEW_FILE_NAME=$(zenity --title="Rename file" --entry --text="Rename file '$2'" --entry-text="$FILE" 2> /dev/null)
if test -n "$NEW_FILE_NAME" && test "$DIR/$NEW_FILE_NAME" != "$2"; then
echo "NEWNAME=$DIR/$NEW_FILE_NAME"
mv -i "$2" "$DIR/$NEW_FILE_NAME"
else
echo "file not renamed"
fi
;;
1)
# Rename file with prefix
PREFIX=$(zenity --title="Prefix file" --entry --text="Give prefix to file '$2'" --entry-text="" 2> /dev/null)
if test -n "$PREFIX"; then
DIR="$(dirname $2)"
FILE="$(basename $2)"
echo "NEWNAME=$DIR/$PREFIX-$FILE"
mv -i "$2" "$DIR/$PREFIX-$FILE"
else
echo "file not renamed"
fi
;;
*)
echo "ERROR: Please provide 0 or 1 as first option"
;;
esac