Skip to Content

unlink {base}

Delete Files and Directories
Package: 
base
Version: 
R 3.0.2

Description

unlink deletes the file(s) or directories specified by x.

Usage

unlink(x, recursive = FALSE, force = FALSE)

Arguments

x
a character vector with the names of the file(s) or directories to be deleted. Wildcards (normally ‘*’ and ‘?’) are allowed.
recursive
logical. Should directories be deleted recursively?
force
logical. Should permissions be changed (if possible) to allow the file or directory to be removed?

Details

Tilde-expansion (see path.expand) is done on x.

If recursive = FALSE directories are not deleted, not even empty ones.

Wildcard expansion is done by the internal code of Sys.glob. Wildcards never match a leading ‘.’ in the filename, and files ‘.’ and ‘..’ will never be considered for deletion.

Values

  for success, 1 for failure, invisibly. Not deleting a non-existent file is not a failure, nor is being unable to delete a directory if recursive = FALSE. However, missing values in x are regarded as failures.

References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole.

See Also

file.remove.

Documentation reproduced from R 3.0.2. License: GPL-2.