| file.access | R Documentation |
Validates whether a file exists and returns detailed file information including permissions, size, type, and timestamps. Supports both local and UNC network paths.
file.access(path)
path |
Character string. File path to validate. |
A list of class file_access_result containing:
path - Normalized file path
exists - TRUE/FALSE
can_read - TRUE/FALSE
can_write - TRUE/FALSE
can_execute - TRUE/FALSE
locked - TRUE/FALSE
size_mb - File size formatted
type - Detected file type description
modified - Last modified timestamp
status - Overall status message
# Create a temp file and check it
tmp <- tempfile(fileext = ".csv")
writeLines("col1,col2\n1,2", tmp)
result <- file.access(tmp)
print(result)
unlink(tmp)
# Check a file that does not exist
result <- file.access(
file.path(tempdir(), "missing.csv")
)
print(result)
# UNC network path (requires network access)
file.access("//server/share/data.csv")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.