/// <summary> /// Creates a symlink for a directory. If it already exists, it is updated. /// </summary> /// <param name="linkPath"> The link path. </param> /// <param name="actualFolderPath"> The actual folder path. </param> /// <remarks> /// </remarks> public void MakeDirectoryLink(string linkPath, string actualFolderPath) { linkPath = linkPath.GetFullPath(); actualFolderPath = GetActualPath(actualFolderPath.GetFullPath()); if (!Directory.Exists(actualFolderPath)) { throw new FileNotFoundException("Cannot link to non-existent directory", actualFolderPath); } if (Directory.Exists(linkPath) && IsSymlink(linkPath)) { ReparsePoint.ChangeReparsePointTarget(linkPath, actualFolderPath); return; } if (File.Exists(linkPath) || Directory.Exists(linkPath)) { throw new ConflictingFileOrFolderException(linkPath); } ReparsePoint.CreateJunction(linkPath, actualFolderPath); }