vsi_rename {gdalraster} | R Documentation |
Rename a file
Description
vsi_rename()
renames a file object in the file system. The GDAL
documentation states it should be possible to rename a file onto a new
filesystem, but it is safest if this function is only used to rename files
that remain in the same directory.
This function goes through the GDAL VSIFileHandler
virtualization and may
work on unusual filesystems such as in memory.
It is a wrapper for VSIRename()
in the GDAL Common Portability Library.
Analog of the POSIX rename()
function.
Usage
vsi_rename(oldpath, newpath)
Arguments
oldpath |
Character string. The name of the file to be renamed. |
newpath |
Character string. The name the file should be given. |
Value
0
on success or -1
on an error.
See Also
renameDataset()
, vsi_copy_file()
Examples
# regular file system for illustration
elev_file <- system.file("extdata/storml_elev.tif", package="gdalraster")
tmp_file <- tempfile(fileext = ".tif")
file.copy(elev_file, tmp_file)
new_file <- file.path(dirname(tmp_file), "storml_elev_copy.tif")
vsi_rename(tmp_file, new_file)
vsi_stat(new_file)
vsi_unlink(new_file)
[Package gdalraster version 1.11.1 Index]