From a vector of given file paths, this function generates short and unique
identifiers for files and folders. The assignements between identifiers and
original paths are stored in two data frames, files
and folders
that are returned.
to_file_database(files, remove_common_base = TRUE)
vector of file paths
if TRUE
(default) the common root of all
files
is removed before creating the database
list of two data frames, files
and folders
paths <- c(
"very_long/very_ugly_path/even with spaces.doc",
"very_long/very_ugly_path/even with spaces.docx"
)
to_file_database(paths)
#> Splitting paths ... ok. (0.00s)
#> Removing the first 1 path segments ... ok. (0.00s)
#> $files
#> file_id file_name folder_id
#> 1 file_01 even with spaces.doc folder_01
#> 2 file_02 even with spaces.docx folder_01
#>
#> $folders
#> folder_id folder_path
#> 1 folder_01 very_ugly_path
#>
to_file_database(paths, remove_common_base = FALSE)
#> $files
#> file_id file_name folder_id
#> 1 file_01 even with spaces.doc folder_01
#> 2 file_02 even with spaces.docx folder_01
#>
#> $folders
#> folder_id folder_path
#> 1 folder_01 very_long/very_ugly_path
#>