Пример #1
0
        public void CreateFolderTest()
        {
            var root = new FtpDirectory(FTP_BASE_URL, credential);
            var dir  = root.GetDirectory("YC.FTP");

            dir.CreateSubdirectory("test");
        }
Пример #2
0
        public void DeleteFileTest()
        {
            var root = new FtpDirectory(FTP_BASE_URL, credential);
            var dir  = root.GetDirectory("YC.FTP");
            var file = dir.GetFile("FILE");

            if (file?.Exists == true)
            {
                file.Delete();
            }
        }
Пример #3
0
        public void AppendFileTest()
        {
            var root   = new FtpDirectory(FTP_BASE_URL, credential);
            var dir    = root.GetDirectory("YC.FTP");
            var file   = dir.GetFile("FILE") ?? dir.CreateFile("FILE");
            var stream = file.OpenAppend();
            var writer = new StreamWriter(stream);

            writer.WriteLine("Hello World, " + DateTime.Now.ToString());
            writer.WriteLine(string.Join("", Enumerable.Repeat(" ", 2048)));
            writer.Flush();
            writer.Close();
        }