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 shell-style file tests.

_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"' (strictly newer than, using the
          modification dates) and '"-ot"' (strictly older than): in
          both cases the test is false unless both files exist.

     x,y: character vectors giving file paths.

_D_e_t_a_i_l_s:

     'Existence' here means being on the file system and accessible by
     the 'stat' system call (or a 64-bit extension) - on a Unix-alike
     this requires execute permission on all of the directories in the
     path that leads to the file, but no permissions on the file
     itself.

_S_e_e _A_l_s_o:

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

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

