First of all: it is released as a NuGet package. Important too: currently it is a pre-release package, because it depends on an SSH.NET package version which is prele-release too. Fortunately, things will change soon.
Because I found two kind of libraries:
Unified filesystem to handle local files, FTP[[E]S]
and SFTP
.
You just need to instantiate a OneFilesystem
. It contains a very few functions (detailed below).
For example:
using (var oneFilesystem = new OneFilesystem())
{
// here, we read some files
var children = oneFilesystem.GetChildren("C:\MyDirectory");
// now, we create another
using (var stream = oneFilesystem.OpenRead("ftp://myserver/somefile.txt"))
{
}
}
OneFilesystem works with URI (where you specify "file"
, "ftp"
, "ftps"
, "ftpes"
or "sftps"
as scheme, a target host and port and a local path). You can also use plain local paths (such as "C:\Windows"
)
All of these path kinds are handled in a unique way by a unique class which is OnePath
.
Fortunately for you (and for me), there are implicit conversions from string
or Uri
.
A very few and simple operations are supported (extending them is planned, but it will stay simple anyway):
GetChildren
GetInformation
OpenRead
CreateFile
CreateDirectory
Delete