当前位置: 首页>>代码示例>>C#>>正文


C# SftpClient.CreateDirectory方法代码示例

本文整理汇总了C#中SftpClient.CreateDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.CreateDirectory方法的具体用法?C# SftpClient.CreateDirectory怎么用?C# SftpClient.CreateDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SftpClient的用法示例。


在下文中一共展示了SftpClient.CreateDirectory方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Test_Sftp_CreateDirectory_Already_Exists

        public void Test_Sftp_CreateDirectory_Already_Exists()
        {
            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                sftp.CreateDirectory("test");

                sftp.CreateDirectory("test");

                sftp.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:13,代码来源:CreateDirectoryTest.cs

示例2: Test_Sftp_CreateDirectory_Without_Connecting

 public void Test_Sftp_CreateDirectory_Without_Connecting()
 {
     using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
     {
         sftp.CreateDirectory("test");
     }
 }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:7,代码来源:SftpClientTest.CreateDirectory.cs

示例3: Test_Sftp_CreateDirectory_Invalid_Path

        public void Test_Sftp_CreateDirectory_Invalid_Path()
        {
            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                sftp.CreateDirectory("/abcdefg/abcefg");

                sftp.Disconnect();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:11,代码来源:SftpClientTest.CreateDirectory.cs

示例4: Test_Sftp_CreateDirectory_In_Current_Location

        public void Test_Sftp_CreateDirectory_In_Current_Location()
        {
            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                sftp.CreateDirectory("test");

                sftp.Disconnect();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:11,代码来源:SftpClientTest.CreateDirectory.cs

示例5: Test_Sftp_DeleteDirectory

        public void Test_Sftp_DeleteDirectory()
        {
            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                sftp.CreateDirectory("abcdef");
                sftp.DeleteDirectory("abcdef");

                sftp.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:12,代码来源:DeleteDirectoryTest.cs

示例6: Test_Sftp_CreateDirectory_In_Forbidden_Directory

        public void Test_Sftp_CreateDirectory_In_Forbidden_Directory()
        {
            if (Resources.USERNAME == "root")
                Assert.Fail("Must not run this test as root!");

            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                sftp.CreateDirectory("/sbin/test");

                sftp.Disconnect();
            }
        }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:14,代码来源:SftpClientTest.CreateDirectory.cs

示例7: Test_Sftp_CreateDirectory_Null

 public void Test_Sftp_CreateDirectory_Null()
 {
     using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
     {
         sftp.CreateDirectory(null);
     }
 }
开发者ID:REALTOBIZ,项目名称:SSH.NET,代码行数:7,代码来源:SftpClientTest.CreateDirectory.cs

示例8: Test_Sftp_Change_Directory

        public void Test_Sftp_Change_Directory()
        {
            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester");

                sftp.CreateDirectory("test1");

                sftp.ChangeDirectory("test1");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1");

                sftp.CreateDirectory("test1_1");
                sftp.CreateDirectory("test1_2");
                sftp.CreateDirectory("test1_3");

                var files = sftp.ListDirectory(".");

                Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}", sftp.WorkingDirectory)));

                sftp.ChangeDirectory("test1_1");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_1");

                sftp.ChangeDirectory("../test1_2");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_2");

                sftp.ChangeDirectory("..");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1");

                sftp.ChangeDirectory("..");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester");

                files = sftp.ListDirectory("test1/test1_1");

                Assert.IsTrue(files.First().FullName.StartsWith(string.Format("{0}/test1/test1_1", sftp.WorkingDirectory)));

                sftp.ChangeDirectory("test1/test1_1");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_1");

                sftp.ChangeDirectory("/home/tester/test1/test1_1");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_1");

                sftp.ChangeDirectory("/home/tester/test1/test1_1/../test1_2");

                Assert.AreEqual(sftp.WorkingDirectory, "/home/tester/test1/test1_2");

                sftp.ChangeDirectory("../../");

                sftp.DeleteDirectory("test1/test1_1");
                sftp.DeleteDirectory("test1/test1_2");
                sftp.DeleteDirectory("test1/test1_3");
                sftp.DeleteDirectory("test1");

                sftp.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:64,代码来源:ListDirectoryTest.cs

示例9: Test_Sftp_ListDirectory_HugeDirectory

        public void Test_Sftp_ListDirectory_HugeDirectory()
        {
            using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
            {
                sftp.Connect();

                //  Create 10000 directory items
                for (int i = 0; i < 10000; i++)
                {
                    sftp.CreateDirectory(string.Format("test_{0}", i));
                    Debug.WriteLine("Created " + i);
                }

                var files = sftp.ListDirectory(".");

                //  Ensure that directory has at least 10000 items
                Assert.IsTrue(files.Count() > 10000);

                sftp.Disconnect();
            }
        }
开发者ID:nahidupa,项目名称:localtunnel-net-client,代码行数:21,代码来源:ListDirectoryTest.cs

示例10: CreatSSHDir

 private static void CreatSSHDir(SftpClient ssh, string file)
 {
     var newDir = Tools.Misc.GetUnixDirecoryOfFile(file);
     if (ssh.Exists(newDir)) return;
     string[] dirs = new string[newDir.ToCharArray().Count(x => x == '/')];
     dirs[0] = newDir;
     for (int i = 1; i < dirs.Count(); i++)
     {
         dirs[i] = Tools.Misc.GetUnixDirecoryOfFile(dirs[i - 1]);
     }
     for (int i = dirs.Count()-1; i >= 0; i--)
     {
         if (ssh.Exists(dirs[i])) continue;
         ssh.CreateDirectory(dirs[i]);
     }
 }
开发者ID:jpmarques,项目名称:mRemoteNC,代码行数:16,代码来源:UI.Window.SSHTransfer.cs

示例11: CreateDirectoryTest

 public void CreateDirectoryTest()
 {
     ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
     SftpClient target = new SftpClient(connectionInfo); // TODO: Initialize to an appropriate value
     string path = string.Empty; // TODO: Initialize to an appropriate value
     target.CreateDirectory(path);
     Assert.Inconclusive("A method that does not return a value cannot be verified.");
 }
开发者ID:pecegit,项目名称:sshnet,代码行数:8,代码来源:SftpClientTest.cs


注:本文中的SftpClient.CreateDirectory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。