Learn R Programming

gdalraster (version 1.11.1)

vsi_mkdir: Create a directory

Description

vsi_mkdir() creates a new directory with the indicated mode. For POSIX-style systems, the mode is modified by the file creation mask (umask). However, some file systems and platforms may not use umask, or they may ignore the mode completely. So a reasonable cross-platform default mode value is 0755. With recursive = TRUE, creates a directory and all its ancestors. This function is a wrapper for VSIMkdir() and VSIMkdirRecursive() in the GDAL Common Portability Library.

Usage

vsi_mkdir(path, mode = "0755", recursive = FALSE)

Value

0 on success or -1 on an error.

Arguments

path

Character string. The path to the directory to create.

mode

Character string. The permissions mode in octal with prefix 0, e.g., "0755" (the default).

recursive

Logical scalar. TRUE to create the directory and its ancestors. Defaults to FALSE.

See Also

vsi_read_dir(), vsi_rmdir()

Examples

Run this code
new_dir <- file.path(tempdir(), "newdir")
vsi_mkdir(new_dir)
vsi_stat(new_dir, "type")
vsi_rmdir(new_dir)

Run the code above in your browser using DataLab