write.access: Check Whether File or Directory is Writable

View source: R/write_access.R

write.accessR Documentation

Check Whether File or Directory is Writable

Description

Validates whether a file or directory can be accessed for writing. Supports both local and UNC network paths.

Usage

write.access(path)

Arguments

path

Character string. Full path to file or directory.

Value

A list of class write_access_result containing:

  • path - Normalized input path

  • exists - TRUE/FALSE

  • type - "File", "Directory", or "New File/Directory"

  • writable - TRUE/FALSE

  • status - Overall status message

Examples

# Check a temporary directory
result <- write.access(tempdir())
print(result)

# Check an existing temporary file
tmp <- tempfile()
writeLines("hello", tmp)
result <- write.access(tmp)
print(result)
unlink(tmp)

# Check a new file path that does not exist yet
result <- write.access(file.path(tempdir(), "newfile.csv"))
print(result)


# UNC network path (requires network access)
write.access("//server/share/output/results.csv")



fileaccess documentation built on June 18, 2026, 1:06 a.m.