R/split_into_root_folder_file_extension.R
split_into_root_folder_file_extension.Rd
Split Full Paths into Root, Folder, File and Extension
split_into_root_folder_file_extension(paths, n_root_parts = 0)
paths | vector of character representing full file paths |
---|---|
n_root_parts | number of first path segments considered as "root" |
data frame with columns root
, folder
, file
,
extension
, depth
paths <- c( "//always/the/same/root/project-1/intro.doc", "//always/the/same/root/project-1/logo.png", "//always/the/same/root/project-2/intro.txt", "//always/the/same/root/project-2/planning/file-1.doc", "//always/the/same/root/project-2/result/report.pdf" ) split_into_root_folder_file_extension(paths)#> Splitting paths ... ok. (0.00s)#> root folder file extension depth #> 1 //always/the/same/root/project-1 intro.doc doc 6 #> 2 //always/the/same/root/project-1 logo.png png 6 #> 3 //always/the/same/root/project-2 intro.txt txt 6 #> 4 //always/the/same/root/project-2/planning file-1.doc doc 7 #> 5 //always/the/same/root/project-2/result report.pdf pdf 7split_into_root_folder_file_extension(paths, n_root_parts = 6)#> Splitting paths ... ok. (0.00s)#>#> root folder file extension depth #> 1 //always/the/same/root/project-1 intro.doc doc 1 #> 2 //always/the/same/root/project-1 logo.png png 1 #> 3 //always/the/same/root/project-2 intro.txt txt 1 #> 4 //always/the/same/root/project-2 planning file-1.doc doc 2 #> 5 //always/the/same/root/project-2 result report.pdf pdf 2split_into_root_folder_file_extension(paths, n_root_parts = 7)#> Splitting paths ... ok. (0.00s)#>#> root folder file extension depth #> 1 //always/the/same/root/project-1 intro.doc doc 1 #> 2 //always/the/same/root/project-1 logo.png png 1 #> 3 //always/the/same/root/project-2 intro.txt txt 1 #> 4 //always/the/same/root/project-2 planning file-1.doc doc 2 #> 5 //always/the/same/root/project-2 result report.pdf pdf 2