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"))

