[GRASS5] [bug #4331] (grass) delete if file exist - flag

Patton, Eric epatton at nrcan.gc.ca
Wed Apr 26 11:34:02 EDT 2006


This functionaltiy would have been really good to know about! I have been
scripting around the overwrite problem without knowing that the --o flag
existed:

eval `g.findfile mapset=PERMANENT element=cell file=$MAP`
if [ -n "$file" ] ; then
echo "Error: file already exists, removing... "
g.remove rast=$MAP
else 
...

Oh well, I get to trim out a lot of useless code from my scripts now ;)

~ Eric.



 

-----Original Message-----
From: grass5-admin at grass.itc.it
To: wegmann at biozentrum.uni-wuerzburg.de; grass5 at grass.itc.it
Sent: 4/25/2006 1:06 PM
Subject: Re: [GRASS5] [bug #4331] (grass) delete if file exist - flag

Martin,

I don't know why --o instead of -o.

I just say discussion of it on the list some time back and filed it away
until I needed it. 

It should be documented if it is not.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


> From: Martin Wegmann <wegmann at biozentrum.uni-wuerzburg.de>
> Reply-To: <wegmann at biozentrum.uni-wuerzburg.de>
> Date: Tue, 25 Apr 2006 18:14:48 +0200
> To: <grass5 at grass.itc.it>
> Subject: Re: [GRASS5] [bug #4331] (grass) delete if file exist - flag
> 
> Hello Michael, 
> 
> to which command do you refer? I looked into the man pages and found
no -o
> flag there and tried it inside GRASS with
r.resample/r.rescale/r.rescale but
> received everytime the "-o is not a valid flag".
> 
> stop wait; I tried it with --o (two dashes) and it works.
> Why two dashes and not one as every other flag?
> 
> thanks for pointing me to it.
> 
> Shall I (or somebody else) add "--o" to all r.* html pages?
> 
> regards, Martin
> 
> On Tuesday 25 April 2006 17:43, Michael Barton wrote:
>> You're in luck. This DOES exist.
>> 
>> Just add --o to the end of a command and it will force an overwrite
of any
>> existing file.
>> 
>> Michael
>> __________________________________________
>> Michael Barton, Professor of Anthropology
>> School of Human Evolution & Social Change
>> Center for Social Dynamics and Complexity
>> Arizona State University
>> 
>> phone: 480-965-6213
>> fax: 480-965-7671
>> www: http://www.public.asu.edu/~cmbarton
>> 
>>> From: Request Tracker <grass-bugs at intevation.de>
>>> Reply-To: Request Tracker <grass-bugs at intevation.de>
>>> Date: Mon, 24 Apr 2006 18:37:29 +0200 (CEST)
>>> To: <grass5 at grass.itc.it>
>>> Subject: [GRASS5] [bug #4331] (grass) delete if file exist - flag
>>> 
>>> this bug's URL: http://intevation.de/rt/webrt?serial_num=4331
>>>
------------------------------------------------------------------------
-
>>> 
>>> Subject: delete if file exist - flag
>>> 
>>> Platform: GNU/Linux/x86
>>> grass obtained from: Trento Italy site
>>> grass binary for platform: Compiled from Sources
>>> GRASS Version: cvs 24.04.2006
>>> 
>>> Hello,
>>> 
>>> a flag for each module to delete a raster/vector if the file already
>>> exists would be good.
>>> A hidden g.remove with the respective name would do the job. That
would
>>> make it easier for users to play with certain settings and not
>>> substituting each time the old name or run g.remove.
>>> 
>>> BTW the delete file handling is not consistent (but I think that has
been
>>> discussed earlier) r.mapcalc is just overwriting the file but e.g.
>>> r.rescale does prompt an error message that the file exist.
>>> 
>>> regards, Martin
>>> 
>>> 
>>> 
>>> -------------------------------------------- Managed by Request
Tracker
>> 
>> _______________________________________________
>> grass5 mailing list
>> grass5 at grass.itc.it
>> http://grass.itc.it/mailman/listinfo/grass5
> 
> -- 
> Martin Wegmann
> 
> DLR - German Aerospace Center
> German Remote Sensing Data Center
> @
> Dept.of Geography
> Remote Sensing and Biodiversity Unit
> &&
> Dept. of Animal Ecology and Tropical Biology
> University of Wuerzburg
> Am Hubland
> 97074 Würzburg
> 
> phone: +49-(0)931 - 888 4797
> mobile: +49-(0)175 2091725
> fax:   +49-(0)931 - 888 4961
> http://www.biota-africa.org
> http://www.biogis.de
> 

_______________________________________________
grass5 mailing list
grass5 at grass.itc.it
http://grass.itc.it/mailman/listinfo/grass5




More information about the grass-dev mailing list