empty_file {baizer}R Documentation

detect whether file is empty recursively

Description

detect whether file is empty recursively

Usage

empty_file(path, strict = FALSE)

Arguments

path

the path of file

strict

FALSE as default. If TRUE, a file with only one character of length 0 will be considered as not empty

Value

logical value

Examples

# create an empty directory
dir.create("some/deep/path/in/a/folder", recursive = TRUE)
empty_dir("some/deep/path/in/a/folder")

# create an empty file
file.create("some/deep/path/in/a/folder/there_is_a_file.txt")
empty_dir("some/deep/path/in/a/folder")
empty_file("some/deep/path/in/a/folder/there_is_a_file.txt", strict = TRUE)

# create a file with only character of length 0
write("", "some/deep/path/in/a/folder/there_is_a_file.txt")
empty_file("some/deep/path/in/a/folder/there_is_a_file.txt", strict = TRUE)
empty_file("some/deep/path/in/a/folder/there_is_a_file.txt")

# clean
unlink("some", recursive = TRUE)


[Package baizer version 0.8.0 Index]