I have permission to read the folder and file, the SFTP user and password.
I have permission to read the folder and file, the SFTP user and password.
First, you do not need an extra component to do the pho3nix
response operations, you can do everything with "pure" .NET, yet another simple operation like the one you want. What's more, the Ftp.dll
package is paid , you may not have noticed this, but just go to their website and see the following message. >
This download is fully functional trial. It has the same features as the registered version. The evaluation version of the component displays "Please purchase a license" dialog. Some uploaded files will have their name changed. To remove this limitation you'll need to purchase the license.
Second, the answer is wrong, at least according to the description of your question. SFTP and FTPS are two completely different things. Briefly:
In this case, you will even need an extra package to help. I found the SSH.NET , it has been a long time that it is not tweaked but it is open source and you can get the most out of it of his profit. I tested it using my server and it worked fine, here is an example of how to do
using (var sftp = new SftpClient(servidor, porta, usuario, senha))
{
sftp.Connect();
DateTime data = sftp.GetLastWriteTime("caminhoDoArquivoNoServidor");
sftp.Disconnect();
}
It may be interesting to search for a package in nuget
You'll need to use a Ftp component
to install:
Install-Package Ftp.dll
Then in your code
// C# version
using (Ftp client = new Ftp())
{
client.Connect("ftp.example.org"); // or ConnectSSL for SSL
client.Login("user", "password");
List<FtpItem> items = client.GetList();
foreach (FtpItem item in items)
{
Console.WriteLine("Name: {0}", item.Name);
Console.WriteLine("Size: {0}", item.Size);
Console.WriteLine("Modify date: {0}", item.ModifyDate);
Console.WriteLine("Is folder: {0}", item.IsFolder);
Console.WriteLine("Is file: {0}", item.IsFile);
Console.WriteLine("Is symlink: {0}", item.IsSymlink);
Console.WriteLine();
}
client.Close();
}