I would like to extract filename from directory in R on Linux Server.
The basename function in R will only work on Windows system. In Python, there is a package called ntpath that could extract filename from directory very easily on Linux environment.
path <- "C:\\Data\\2019\\201907\\20190726\\myfile.txt"
name <- basename(path)
The expected output would be myfile.txt. However, this will only work in Windows system but not Linux server. Basename function on Linux Server will give the full path.