[GRASS-user] Copying many files of same pattern from one mapset to another

Nikos Alexandris nik at nikosalexandris.net
Thu Dec 14 15:43:04 PST 2017


Rich Shepard:

>   Can't directly move maps from one mapset to another using rename
> (unless
> I'm misreading the manual page), so I need to copy them to the current
> mapset, then change to the source mapset and remove them.
>
>   The g.copy man page does not indicate using regex or pattern to copy
> many
> files at the same time. I have a set of 72 maps of the same pattern
> (test4blk_h_*) created in the wrong mapset. I want to copy them to the
> proper mapset. Is there a way to do this with a single command?

Micha Silver:

>>   I do:
>>   for r in `g.list rast pattern=test4blk_h_* mapset=other_mapset`; do
>>   g.copy rast=${r}@other_mapset,${r};
>>   done

For similarly named maps spread in various Mapsets:

for SCENE in $MAPSETS ;do
        g.copy raster=${PREFIX}@${SCENE},${PREFIX}_${SCENE}
        g.remove -f type=raster name=${PREFIX}@${SCENE}
done

Nikos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20171215/51a48248/attachment.sig>


More information about the grass-user mailing list