Learn R Programming

gdalraster (version 1.11.1)

vsi_unlink: Delete a file

Description

vsi_unlink() deletes a file object from the file system. This function goes through the GDAL VSIFileHandler virtualization and may work on unusual filesystems such as in memory. It is a wrapper for VSIUnlink() in the GDAL Common Portability Library. Analog of the POSIX unlink() function.

Usage

vsi_unlink(filename)

Value

0 on success or -1 on an error.

Arguments

filename

Character string. The path of the file to be deleted.

See Also

deleteDataset(), vsi_rmdir(), vsi_unlink_batch()

Examples

Run this code
# regular file system for illustration
elev_file <- system.file("extdata/storml_elev.tif", package="gdalraster")
tmp_file <- file.path(tempdir(), "tmp.tif")
file.copy(elev_file,  tmp_file)
vsi_stat(tmp_file)
vsi_unlink(tmp_file)
vsi_stat(tmp_file)

Run the code above in your browser using DataLab