How do I extract a file/folder_name only from a path?
If I understand correctly, you could use the basename
function.
f <- "/long/path/to/file"
basename(f)
# [1] "file"
What about this?
> path <- "/long/path/to/file"
> require(stringr)
> str_extract(path, "[^/]*$")
[1] "file"