public static Hardlink ( [ source, [ destination, bool overwrite = false ) : void | ||
source | [ | |
destination | [ | |
overwrite | bool | |
return | void |
public static void Hardlink([NotNull] string source, [NotNull] string destination, bool overwrite = false) {
if (source == null) throw new ArgumentNullException(nameof(source));
if (destination == null) throw new ArgumentNullException(nameof(destination));
if (overwrite && File.Exists(destination)) {
File.Delete(destination);
}
Kernel32.CreateHardLink(destination, source, IntPtr.Zero);
}