unlink2: Delete files and directories

View source: R/unlink2.R

unlink2R Documentation

Delete files and directories

Description

Delete files and directories

Usage

unlink2(x)

Arguments

x

character. Files or directories to be deleted. Unlink base unlink, these must exist on disk or the function will intentionally error.

Details

This variant hardens file path handling, for better Windows compatibility.

Value

integer(1). 0 for success, 1 for failure, invisibly.

Note

Updated 2022-06-08.

Examples

tempdir <- tempdir2()
x <- file.path(tempdir, "file.txt")
y <- file.path(tempdir, "directory")
invisible(file.create(x))
invisible(dir.create(y))
out <- unlink2(c(x, y))
print(out)

acidgenomics/AcidBase documentation built on Jan. 28, 2024, 2:59 a.m.