Skip to contents

Get the names of all csv files from the input character vector.

Usage

get_csv_files_and_folders(input, except, basepath, logger = NA)

Arguments

input

a character vector of valid paths: can be files and/or folders

except

files to ignore (optional): all paths for (a part of) which match the exact expression in except will be ignored.

basepath

the part of the path that should be ignored when copying final files (i.e. absolute path inside one's comupter that should not be copied in final file.)

logger

a log4r logger object if you want logging (can be created with create_logger), else NA.

Value

A dataframe with columns folders and files, where folders are the paths up to a given file (corresponding to the relative path to the file from basepath), and files are the files paths from folders.

Details

input can be a vector of files and/or folders. If an element of input is a folder, the function will list all files within input; if the element is a file, the function will only list this file.

Examples

if (FALSE) {
get_csv_files_and_folders(input = c("path/to/datafolder/KGA",
                                    "path/to/datafolder/ATH_Roll1_Snapshot.csv"), 
                                    except = "KGA/KGA-KHO_together", 
                                    basepath = "path/to/datafolder")
}