[GRASS-user] g.rename in a loop has no real effect

Glynn Clements glynn at gclements.plus.com
Sat Oct 11 22:36:51 EDT 2008


Nikos Alexandris wrote:

> (using GRASS 6.4.svn under Ubuntu 64-bit)

> PERMANENT/cell > for x in L7*; do g.rename rast=$x,`echo $x | tr '[:upper:]' '[:lower:]'`; done

> Why doesn't it work properly here?

It has nothing to do with the loop. g.rename does nothing if the new
name is the same as the old one, ignoring case.

This check was added relatively recently, to prevent it from
destroying data on filesystems which aren't case sensitive. If you run
the above command on a FAT or NTFS filesystem, it would simply delete
the maps.

[It deletes the destination first; if the destination is the same as
the source (apart from case), then it ends up deleting the source.]

If you want to change the case of your map names, you first need to
rename the map to a name which differs by more than case, then rename
it to the intended name.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-user mailing list