EVOLUTION-MANAGER
Edit File: unlink.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Delete Files and Directories</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="R.css" /> </head><body> <table width="100%" summary="page for unlink {base}"><tr><td>unlink {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Delete Files and Directories</h2> <h3>Description</h3> <p><code>unlink</code> deletes the file(s) or directories specified by <code>x</code>. </p> <h3>Usage</h3> <pre>unlink(x, recursive = FALSE, force = FALSE)</pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>a character vector with the names of the file(s) or directories to be deleted. Wildcards (normally ‘<span class="file">*</span>’ and ‘<span class="file">?</span>’) are allowed.</p> </td></tr> <tr valign="top"><td><code>recursive</code></td> <td> <p>logical. Should directories be deleted recursively?</p> </td></tr> <tr valign="top"><td><code>force</code></td> <td> <p>logical. Should permissions be changed (if possible) to allow the file or directory to be removed?</p> </td></tr> </table> <h3>Details</h3> <p>Tilde-expansion (see <code><a href="path.expand.html">path.expand</a></code>) is done on <code>x</code>. </p> <p>If <code>recursive = FALSE</code> directories are not deleted, not even empty ones. </p> <p>On most platforms ‘file’ includes symbolic links, fifos and sockets. <code>unlink(x, recursive = TRUE)</code> deletes the just symbolic link if the target of such a link is a directory. </p> <p>Wildcard expansion is done by the internal code of <code><a href="Sys.glob.html">Sys.glob</a></code>. Wildcards never match a leading ‘<span class="file">.</span>’ in the filename, and files ‘<span class="file">.</span>’ and ‘<span class="file">..</span>’ will never be considered for deletion. Wildcards will only be expanded if the system supports it. Most systems will support not only ‘<span class="file">*</span>’ and ‘<span class="file">?</span>’ but also character classes such as ‘<span class="file">[a-z]</span>’ (see the <code>man</code> pages for the system call <code>glob</code> on your OS). The metacharacters <code>* ? [</code> can occur in Unix filenames, and this makes it difficult to use <code>unlink</code> to delete such files (see <code><a href="files.html">file.remove</a></code>), although escaping the metacharacters by backslashes usually works. If a metacharacter matches nothing it is considered as a literal character. </p> <p><code>recursive = TRUE</code> might not be supported on all platforms, when it will be ignored, with a warning: however there are no known current examples. </p> <h3>Value</h3> <p><code>0</code> for success, <code>1</code> for failure, invisibly. Not deleting a non-existent file is not a failure, nor is being unable to delete a directory if <code>recursive = FALSE</code>. However, missing values in <code>x</code> are regarded as failures. </p> <h3>References</h3> <p>Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) <em>The New S Language</em>. Wadsworth & Brooks/Cole. </p> <h3>See Also</h3> <p><code><a href="files.html">file.remove</a></code>. </p> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>