[R-sig-Geo] delete shapefile in the directory

Paul Hiemstra p.hiemstra at geo.uu.nl
Mon Mar 23 10:06:30 CET 2009


Hi,

You can also use the command file.remove. The advantage of using this 
command in stead of the system call that Agustin suggested is that the 
code will work on all OS'es. If you use a call like system("rm 
/foo/bar") this works on Linux but not on Windows.

In addition, shapefiles are ofcourse a collection of files. You can use 
file.remove in combination with list.files to delete all the files that 
form a shapefile. If the base name of the shapefile is foo_bar:

file.remove(list.files(pattern="foo_bar"))

cheers
Paul

Agustin Lobo wrote:
> system()
> lets you run any command on your OS
> Agus
>
> gianni lavaredo wrote:
>> Hi all
>>
>> is there a code to delete shapefie in a directory?
>>
>> thanks
>>
>> Gianni
>>
>>     [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>>   
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>   


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul



More information about the R-sig-Geo mailing list