file_test               package:utils               R Documentation

_S_h_e_l_l-_s_t_y_l_e _T_e_s_t_s _o_n _F_i_l_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     Utility for testing files.

_U_s_a_g_e:

     file_test(op, x, y)

_A_r_g_u_m_e_n_t_s:

      op: a character string specifying the test to be performed. Unary
          tests (only 'x' is used) are '"-f"' (existence and not being
          a directory) and '"-d"' (existence and directory); binary
          tests are '"-nt"' (newer than, using the modification dates)
          and '"-ot"'.

     x,y: character vectors giving file paths.

_D_e_t_a_i_l_s:

     'file_test' performs shell-style file tests.

     Note that 'file.exists' only tests for existence ('test -e' on
     some systems) but not for not being a directory.

_S_e_e _A_l_s_o:

     'file.path', 'file.info'

_E_x_a_m_p_l_e_s:

     dir <- file.path(R.home(), "library", "stats")
     file_test("-d", dir)
     file_test("-nt", file.path(dir, "R"), file.path(dir, "demo"))

