This help topic is for R version 2.9.0. For the current version of R, try https://stat.ethz.ch/R-manual/R-patched/library/base/html/unlink.html
unlink {base}R Documentation

Description

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

Usage

unlink(x, recursive = 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?

Details

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

On most platforms ‘file’ includes symbolic links, fifos and sockets. Some earlier versions of R would bot try to remove broken symbolic links.

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. Wildcards will only be expanded if the system supports it. Most systems will support not only ‘*’ and ‘?’) but character classes such as ‘[a-z]’ (see the man pages for glob). The metacharacters * ? [ can occur in Unix filenames, and this makes it difficult to use unlink to delete such files (see file.remove), although escaping the metacharacters by backslashes usually works. If a metacharacter matches nothing it is considered as a literal character.

recursive = TRUE is not supported on all platforms, and may be ignored, with a warning.

Value

0 for success, 1 for failure. 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 result 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.


[Package base version 2.9.0 ]