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

   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?

Rich

Hi Rich:

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

···

On 12/14/2017 07:17 PM, Rich Shepard wrote:

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?

Rich


grass-user mailing list
grass-user@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-user

-- 
Micha Silver
Ben Gurion Univ.
Sde Boker, Remote Sensing Lab
cell: +972-523-665918

2017-12-14 19:36 GMT+01:00 Micha Silver <tsvibar@gmail.com>:

  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?

https://grass.osgeo.org/grass72/manuals/addons/g.copyall.html

Ma

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa

On Thu, 14 Dec 2017, Micha Silver wrote:

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

  
Micha,

   Sigh. I keep forgetting that a simple bash script will do the job.

Thanks,

Rich

On Thu, 14 Dec 2017, Martin Landa wrote:

https://grass.osgeo.org/grass72/manuals/addons/g.copyall.html

Martin,

   Ah, that's an addon. Good to know.

Thanks,

Rich

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

On Fri, Dec 15, 2017 at 12:43 AM, Nikos Alexandris
<nik@nikosalexandris.net> wrote:
...

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

Interesting! Maybe worth a flag for optionally having such a feature
in the g.copyall addon?

Markus

* Markus Neteler <neteler@osgeo.org> [2017-12-15 09:17:26 +0100]:

On Fri, Dec 15, 2017 at 12:43 AM, Nikos Alexandris
<nik@nikosalexandris.net> wrote:
...

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

Would g.move module/script make sense?

Nikos