EVOLUTION-MANAGER
Edit File: file.access.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: Ascertain File Accessibility</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 file.access {base}"><tr><td>file.access {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Ascertain File Accessibility</h2> <h3>Description</h3> <p>Utility function to access information about files on the user's file systems. </p> <h3>Usage</h3> <pre> file.access(names, mode = 0) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>names</code></td> <td> <p>character vector containing file names. Tilde-expansion will be done: see <code><a href="path.expand.html">path.expand</a></code>.</p> </td></tr> <tr valign="top"><td><code>mode</code></td> <td> <p>integer specifying access mode required: see ‘Details’.</p> </td></tr> </table> <h3>Details</h3> <p>The <code>mode</code> value can be the exclusive or of the following values </p> <dl> <dt>0</dt><dd><p>test for existence.</p> </dd> <dt>1</dt><dd><p>test for execute permission.</p> </dd> <dt>2</dt><dd><p>test for write permission.</p> </dd> <dt>4</dt><dd><p>test for read permission.</p> </dd> </dl> <p>Permission will be computed for real user ID and real group ID (rather than the effective IDs). </p> <p>Please note that it is not a good idea to use this function to test before trying to open a file. On a multi-tasking system, it is possible that the accessibility of a file will change between the time you call <code>file.access()</code> and the time you try to open the file. It is better to wrap file open attempts in <code><a href="try.html">try</a></code>. </p> <h3>Value</h3> <p>An integer vector with values <code>0</code> for success and <code>-1</code> for failure. </p> <h3>Note</h3> <p>This is intended as a replacement for the S-PLUS function <code>access</code>, a wrapper for the C function of the same name, which explains the return value encoding. Note that the return value is <b>false</b> for <b>success</b>. </p> <h3>See Also</h3> <p><code><a href="file.info.html">file.info</a></code> for more details on permissions, <code><a href="files2.html">Sys.chmod</a></code> to change permissions, and <code><a href="try.html">try</a></code> for a ‘test it and see’ approach. </p> <p><code><a href="../../utils/html/filetest.html">file_test</a></code> for shell-style file tests. </p> <h3>Examples</h3> <pre> fa <- file.access(dir(".")) table(fa) # count successes & failures </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>