Friday, 25 November 2016

My standard set of Nautilus scripts

By stuffing these script files into

~/.local/share/nautilus/scripts

and making them executable, you can select them by right-clicking (a) file(s) in the Nautilus windows and selecting from the "scripts" sub-menu.

lowercase

#!/bin/sh
# lowercase: Changes input to lowercase.
for arg
do
tmp=`echo "$arg" | tr '[A-Z]' '[a-z]'`

if [ -f $tmp ]
then
msg="Lowercase filename: '$tmp' already exists."
gdialog --msgbox "$msg" 100 100
else
mv "$arg" "$tmp"
fi
done

UPPERCASE

#!/bin/sh
# uppercase: Renames input file to uppercase.
for arg
do
tmp=`echo "$arg" | tr '[a-z]' '[A-Z]'`

if [ -f $tmp ]
then
msg="Uppercase filename: '$tmp' already exists."
gdialog --msgbox "$msg" 100 100
else
mv "$arg" "$tmp"
fi
done

underscore

#!/bin/sh
# lowercase: Changes input to lowercase.
for arg
do
tmp=`echo "$arg" | tr '[ ]' '[_]'`

if [ -f $tmp ]
then
msg="Translated filename: '$tmp' already exists."
gdialog --msgbox "$msg" 100 100
else
mv "$arg" "$tmp"
fi
done