Examples for 'R.utils::getRelativePath.default'


Gets the relative pathname relative to a directory

Aliases: getRelativePath.default getRelativePath

Keywords: IO programming

### ** Examples

  getRelativePath("foo", "foo")                       # "."
[1] "."
  getRelativePath("foo/bar", "foo")                   # "bar"
[1] "bar"
  getRelativePath("foo/bar", "foo/bar/yah")           # ".."
[1] ".."
  getRelativePath("foo/bar/cool", "foo/bar/yah/sub/") # "../../cool"
[1] "../../cool"
  getRelativePath("/tmp/bar/", "/bar/foo/")           # "../../tmp/bar"
[1] "../../tmp/bar"
  # Windows
  getRelativePath("C:/foo/bar/", "C:/bar/")           # "../foo/bar"
[1] "../foo/bar"
  getRelativePath("C:/foo/bar/", "D:/bar/")           # "C:/foo/bar"
[1] "C:/foo/bar"

[Package R.utils version 2.11.0 Index]