file.access               package:base               R Documentation

_A_s_c_e_r_t_a_i_n _F_i_l_e _A_c_c_e_s_s_i_b_i_l_i_t_y

_D_e_s_c_r_i_p_t_i_o_n:

     Utility function to access information about files on the user's
     file systems.

_U_s_a_g_e:

     file.access(names, mode = 0)

_A_r_g_u_m_e_n_t_s:

   names: character vector containing file names.

    mode: integer specifying access mode required.

_D_e_t_a_i_l_s:

     The 'mode' value can be the exclusive or of the following values

     _0 test for existence.

     _1 test for execute permission.

     _2 test for write permission.

     _4 test for read permission.

     Permission will be computed for real user ID and real group ID
     (rather than the effective IDs).

     Please note that it is not good 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 'file.access()' and the time you try to open the
     file, and in recent Windows versions the underlying function in
     'msvcrt.dll' sometimes returns inaccurate values.  It is better to
     wrap  file open attempts in 'try' instead.

_V_a_l_u_e:

     An integer vector with values '0' for success and '-1' for
     failure.

_N_o_t_e:

     This is intended as a replacement for the S-PLUS function
     'access', a wrapper for the C function of the same name, which
     explains the return value encoding.  Note that the return value is
     *false* for *success*.

_S_e_e _A_l_s_o:

     'file.info', 'try'

_E_x_a_m_p_l_e_s:

     fa <- file.access(dir("."))
     table(fa) # count successes & failures

