First try to create a hardlink to the file. If that fails, try a symbolic link (symlink) before falling back to copying the file. "File" here can mean a file or a directory.

linkOrCopy(from, to, allowSymlink = FALSE)

fileRenameOrMove(from, to)

## Arguments

from, to

character vectors, containing file names or paths.

Logical. If FALSE, the default, then it will try file.link first, then file.copy, omitting the file.symlink step