| unlink | R Documentation |
unlink deletes the file(s) or directories specified byx.
unlink(x, recursive = FALSE, force = FALSE, expand = TRUE)
x | a character vector with the names of the file(s) ordirectories to be deleted. |
recursive | logical. Should directories be deleted recursively? |
force | logical. Should permissions be changed (if possible) toallow the file or directory to be removed? |
expand | logical. Should wildcards (see ‘Details’ below) andtilde (see |
Ifrecursive = FALSE directories are not deleted,not even empty ones.
On most platforms ‘file’ includes symbolic links, fifos andsockets.unlink(x, recursive = TRUE)deletes just the symbolic link if the target of such a link is a directory.
Wildcard expansion (normally ‘*’ and ‘?’ are allowed) is done bythe internal code ofSys.glob. Wildcards never match aleading ‘.’ in the filename, and files ‘.’, ‘..’ and‘~’ will never be considered for deletion.Wildcards will only be expanded if the system supports it. Mostsystems will support not only ‘*’ and ‘?’ but also characterclasses such as ‘[a-z]’ (see theman pages for the systemcallglob on your OS). The metacharacters* ? [ canoccur in Unix filenames, and this makes it difficult to useunlink to delete such files (seefile.remove),although escaping the metacharacters by backslashes usually works. Ifa metacharacter matches nothing it is considered as a literalcharacter.
recursive = TRUE might not be supported on all platforms, when itwill be ignored, with a warning: however there are no known currentexamples.
0 for success,1 for failure, invisibly.Not deleting a non-existent file is not a failure, nor is being unableto delete a directory ifrecursive = FALSE. However, missingvalues inx are regarded as failures.
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)The New S Language.Wadsworth & Brooks/Cole.
file.remove.
Add the following code to your website.
For more information on customizing the embed code, readEmbedding Snippets.
