0

In linux machines, it is possible to access where a symbolic link is pointing to by using Sys.readlink function in R or readlink from the command line. Reading its documentation, we see that this is not intended for Windows shortcuts.

In Windows I have not been able to find a one liner to give me where the file points to. The closest I got was from this SO question that demonstrates the use of dir. While the output was not perfect I figured with some regex magic I could isolate the file path.

However when I tried system2('dir'), I received the error "dir" not found.

Is there (a better) way for me to access the file path of a Windows shortcut from R and why can't I use dir through a system call in R?

OganM
  • 2,543
  • 16
  • 33

1 Answers1

1

For anyone in the future finding this thread, the answer is fs::link_path() as pointed out by Edward Visel

DeanAttali
  • 25,268
  • 10
  • 92
  • 118