Dirname doesn't follow command till the end of the path

19 Views Asked by At

I want to use dirname to specify my root directory, but it always stops specifying the folder one before the final folder.

I want to set my working directories and have done so in the beginning of my script like this:

dir <- list()
dir$root <- dirname("/Users/myname/parent_folder/sub_folder")
dir$inp <- normalizePath(paste0(dir$root, "/input"))
dir$out <- normalizePath(paste0(dir$root, "/output"))

However, when I print dir$root, it shows me "/Users/myname/parent_folder".

I tried changing the paths several times, but no matter what, dirname always stops specifying the folder one before the final folder. I would appreciate any help, thank you!

0

There are 0 best solutions below