The usually so called shapefiles are typically not files but a couple of them with different extensions. Thus it is not very convenient to rename them.
Fortunately a Unix Shell is a very powerful tool so here comes shpmv which is a simple bash shell function. Just put it in your .bashrc. It works fine regardless if an extension (e.g. .shp) is given or not.
function shpmv() {
if [ $# -ne 2 ]; then
echo "shpmv: rename shapefiles"
echo "usage: shpmv "
return
fi
src="${1%.*}"
tgt="${2%.*}"
if ! [ -f $src.shp ]; then
echo "$src.shp: file not found"
return
fi
for f in $src.*; do
ext="${f##*.}"
mv $f $tgt.$ext
done
}
Neueste Kommentare