本文整理汇总了C#中SftpClient.SynchronizeDirectories方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.SynchronizeDirectories方法的具体用法?C# SftpClient.SynchronizeDirectories怎么用?C# SftpClient.SynchronizeDirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SftpClient
的用法示例。
在下文中一共展示了SftpClient.SynchronizeDirectories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Sftp_SynchronizeDirectories
public void Test_Sftp_SynchronizeDirectories()
{
RemoveAllFiles();
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
string uploadedFileName = Path.GetTempFileName();
string sourceDir = Path.GetDirectoryName(uploadedFileName);
string destDir = "/";
string searchPattern = Path.GetFileName(uploadedFileName);
var upLoadedFiles = sftp.SynchronizeDirectories(sourceDir, destDir, searchPattern);
Assert.IsTrue(upLoadedFiles.Count() > 0);
foreach (var file in upLoadedFiles)
{
Debug.WriteLine(file.FullName);
}
sftp.Disconnect();
}
}
示例2: SynchronizeDirectoriesTest
public void SynchronizeDirectoriesTest()
{
ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
SftpClient target = new SftpClient(connectionInfo); // TODO: Initialize to an appropriate value
string sourcePath = string.Empty; // TODO: Initialize to an appropriate value
string destinationPath = string.Empty; // TODO: Initialize to an appropriate value
string searchPattern = string.Empty; // TODO: Initialize to an appropriate value
IEnumerable<FileInfo> expected = null; // TODO: Initialize to an appropriate value
IEnumerable<FileInfo> actual;
actual = target.SynchronizeDirectories(sourcePath, destinationPath, searchPattern);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}