Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

file_access

Query for existence and access permissions


Description

file_exists(path) is a shortcut for file_access(x, "exists"); dir_exists(path) and link_exists(path) are similar but also check that the path is a directory or link, respectively.

Usage

file_access(path, mode = "exists")

file_exists(path)

dir_exists(path)

link_exists(path)

Arguments

path

A character vector of one or more paths.

mode

A character vector containing one or more of 'exists', 'read', 'write', 'execute'.

Details

Cross-compatibility warning: There is no executable bit on Windows. Checking a file for mode 'execute' on Windows, e.g. file_access(x, "execute") will always return TRUE.

Value

A logical vector, with names corresponding to the input path.

Examples

file_access("/")
file_access("/", "read")
file_access("/", "write")

file_exists("WOMBATS")

fs

Cross-Platform File System Operations Based on 'libuv'

v1.5.0
GPL-3
Authors
Jim Hester [aut, cre], Hadley Wickham [aut], libuv project contributors [cph] (libuv library), Joyent, Inc. and other Node contributors [cph] (libuv library), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.