Skip to contents

Read Files Containing File Path Information from Folder

Usage

read_path_information(file_info_dir, pattern = "^path-info", ...)

Arguments

file_info_dir

path to folder in which to look for files matching pattern

pattern

pattern to match against the file names to be read. Default: "^path-info"

...

further arguments passed to read_file_paths

Examples

# Set root directory (here: package installation directory of kwb.fakin)
root_dir <- system.file(package = "kwb.fakin")

# Set output directory
output_dir <- tempdir()

# Write all paths below root_dir into a "path-info"-file
fakin.path.app::get_and_save_file_info(root_dir, output_dir)
#> Getting file information on files below /Users/runner/work/_temp/Library/kwb.fakin ... ok. (0.00s) 
#> Elapsed: 0.003 
#> Writing to '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpAqBTLj/path-info_2022-06-09_0501_kwb.fakin.csv' with data.table::fwrite() ... ok. (0.00s) 
#> Elapsed: 0.002 
#> [1] "/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpAqBTLj/path-info_2022-06-09_0501_kwb.fakin.csv"

# Read the "path-info"-files that are (now) found in output_dir
path_info <- kwb.fakin:::read_path_information(output_dir)
#> Encodings guessed by readr:
#> [1] "ASCII"
#> Selected encoding: ascii
#> Reading file with read_file_info() ... Reading '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T//RtmpAqBTLj/path-info_2022-06-09_0501_kwb.fakin.csv' with data.table::fread() ... ok. (0.24s) 
#> Converting file size to MiB ... ok. (0.00s) 
#> ok. (0.25s)