Skip to content
Prev 5320 / 29559 Next

delete shapefile in the directory

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: