Learn R Programming

baizer (version 0.8.0)

empty_file: detect whether file is empty recursively

Description

detect whether file is empty recursively

Usage

empty_file(path, strict = FALSE)

Value

logical value

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

Examples

Run this code
# 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)

Run the code above in your browser using DataLab