FluentFTP 추가

This commit is contained in:
2018-01-02 01:12:03 +09:00
parent ff43fbd1f4
commit 663d2977ed
30 changed files with 19114 additions and 2 deletions

41
FileTransfer.cs Normal file
View File

@@ -0,0 +1,41 @@
using FluentFTP;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AutoSellerNS
{
class FileTransfer
{
const string HOST = "mjjo53.us.to";
const string USER = "trader";
const string PASSWORD = "sbtmaoao";
const string REMOTE_BASE_PATH = "/";
public async void SendDir(string localDir, string remoteDir)
{
try
{
using (FtpClient client = new FtpClient(HOST, USER, PASSWORD))
{
client.ConnectTimeout = 3000;
client.RetryAttempts = 3;
string project_path = Path.GetDirectoryName(Path.GetDirectoryName(System.IO.Directory.GetCurrentDirectory()));
List<string> files = Directory.GetFiles(project_path + localDir).ToList();
string remotePath = REMOTE_BASE_PATH + remoteDir;
await client.ConnectAsync();
await client.UploadFilesAsync(files, remotePath, FtpExists.Overwrite);
//await client.ChmodAsync(remotePath, 777);
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}
}
}