NCode.ReparsePoints
1.2.0
Prefix Reserved
dotnet add package NCode.ReparsePoints --version 1.2.0
NuGet\Install-Package NCode.ReparsePoints -Version 1.2.0
<PackageReference Include="NCode.ReparsePoints" Version="1.2.0" />
<PackageVersion Include="NCode.ReparsePoints" Version="1.2.0" />
<PackageReference Include="NCode.ReparsePoints" />
paket add NCode.ReparsePoints --version 1.2.0
#r "nuget: NCode.ReparsePoints, 1.2.0"
#:package NCode.ReparsePoints@1.2.0
#addin nuget:?package=NCode.ReparsePoints&version=1.2.0
#tool nuget:?package=NCode.ReparsePoints&version=1.2.0
NCode.ReparsePoints
Create and inspect Win32 file and folder reparse points such as hard links, junctions (also known as soft links) and symbolic links. The library wraps the Win32 APIs through P/Invoke, so it runs only on Windows, and targets .NET Framework 4.5.1.
Installation
Add the package to a project:
dotnet add package NCode.ReparsePoints
Quick start
using System;
using NCode.ReparsePoints;
internal static class Program
{
private static void Main()
{
var provider = ReparsePointFactory.Provider;
provider.CreateLink(@"D:\NewJunction", @"C:\SourceDir", LinkType.Junction);
var link = provider.GetLink(@"D:\NewJunction");
Console.WriteLine("Type: {0}", link.Type);
Console.WriteLine("Target: {0}", link.Target);
}
}
Usage
ReparsePointFactory.Provider returns the default IReparsePointProvider, and ReparsePointFactory.Create() a new one:
| Member | What it does |
|---|---|
LinkType GetLinkType(string path) |
Says whether the path is a hard link, a junction, a symbolic link or none of them (LinkType.Unknown). |
ReparseLink GetLink(string path) |
Returns the link's Attributes (FileAttributes), Type (LinkType) and Target; the target of a hard link can't be determined, so it is null. |
void CreateLink(string path, string target, LinkType type) |
Creates a hard link, a junction or a symbolic link at path that points to target. |
ReparsePointProvider implements the interface, and its CreateHardLink, CreateJunction and CreateSymbolicLink methods are virtual.
Hard link
Technically speaking a hard link is not a reparse point on Win32 systems: it is a type of file pointer supported since Windows XP and Windows Server 2003.
- Files only.
- Must be on the same volume and the same computer.
- No special privileges required, other than file security.
See Hard Links and Junctions for more information.
Junction
- Directories only, supported since Windows XP and Windows Server 2003.
- Resolved by the server, not the client.
- Can be on a different volume, but must be on the same computer.
- No special privileges required, other than folder security.
See Hard Links and Junctions for more information.
Symbolic link
- Files or directories, supported since Windows Vista and Windows Server 2008.
- Resolved by the client, not the server.
- Can be on a different volume or a different computer.
- Requires the
SeCreateSymbolicLinkPrivilegeright: administrator accounts have it by default, but must run elevated, and other accounts must be granted it in Local Security Policy.
See Symbolic Links for more information.
More
The repository holds the source, the issues, the changelog, how to contribute and how to report a vulnerability. NCode.ReparsePoints is licensed under the Apache License 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net451 is compatible. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
.NETFramework 4.5.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on NCode.ReparsePoints:
| Repository | Stars |
|---|---|
|
Chaoses-Ib/ObsidianShell
Associate Markdown files with Obsidian
|
See the changelog: https://github.com/NCodeGroup/NCode.ReparsePoints/blob/HEAD/CHANGELOG.md