Darwin.CopyFile
1.0.0
dotnet add package Darwin.CopyFile --version 1.0.0
NuGet\Install-Package Darwin.CopyFile -Version 1.0.0
<PackageReference Include="Darwin.CopyFile" Version="1.0.0" />
paket add Darwin.CopyFile --version 1.0.0
#r "nuget: Darwin.CopyFile, 1.0.0"
// Install Darwin.CopyFile as a Cake Addin #addin nuget:?package=Darwin.CopyFile&version=1.0.0 // Install Darwin.CopyFile as a Cake Tool #tool nuget:?package=Darwin.CopyFile&version=1.0.0
Darwin.CopyFile
A binding to the Darwin OS copyfile
API.
The Darwin copyfile
API can copy files, their metadata, extended
attributes, recursive directory and supports fast copies using
cloning (for files hosted on APFS on macOS and iOS).
You can use this as either a NuGet (Darwin.CopyFile), or you can just copy the single C# file into your project.
API Documentation
You can browse the API Documentation
Using the API
The main API is:
public class CopyFile {
static Status Copy (string from, string to, Flags flags, State state = null);
}
Generally, you will configure the operatiob by passing the desired flags to Copy which controls whether to perform nested copied, whether to use cloning, copy attributes and so on.
Examples
Copy a file:
CopyFile.Copy ("/etc/hosts", "/tmp/hostscopy", CopyFile.Flags.All);
Copy a file, using cloning:
CopyFile.Copy ("/etc/hosts", "/tmp/hosts", CopyFile.Flags.All | CopyFile.Flags.Clone);
Copy a file, using clone, two times:
CopyFile.Copy ("/etc/hosts", "/tmp/hosts2", CopyFile.Flags.All | CopyFile.Flags.Clone);
// This fails, becaue Clone refuses to override the file if the target exists:
CopyFile.Copy ("/etc/hosts", "/tmp/hosts2", CopyFile.Flags.All | CopyFile.Flags.Clone);
// Tell Copy to unlink (remove) the target if it is present:
CopyFile.Copy ("/etc/hosts", "/tmp/hosts2", CopyFile.Flags.All | CopyFile.Flags.Clone | CopyFile.Flags.Unlink);
Copy a file, only if the target does not exist (returns EEXIST) error if this is the case:
CopyFile.Copy ("/etc/hosts", "/tmp/hosts", CopyFile.Flags.All | CopyFile.Flags.Excl)
Recursively copy a directory, using clone:
CopyFile.Copy ("/Users/miguel/Desktop", "/tmp/CopyDesktop", CopyFile.Flags.All | CopyFile.Flags.Clone | CopyFile.Flags.Recursive);
Controling Recursive Copies
The State
object is used to control how recursive copies are
performed, you create a state object and you can further customize how
the copy works by providing a callback to it and accessing the State
object from the callback.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp1.0 was computed. netcoreapp1.1 was computed. netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard1.5 is compatible. netstandard1.6 was computed. netstandard2.0 was computed. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen30 was computed. tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 1.5
- NETStandard.Library (>= 1.6.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 1,127 | 6/6/2018 |