myWorkingFTP
This commit is contained in:
@@ -117,7 +117,7 @@ namespace SanSystem
|
|||||||
txt_temp_aussen.Update();
|
txt_temp_aussen.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void DownloadFromUV()
|
private void DownloadFromUV()
|
||||||
{
|
{
|
||||||
Progress<double> progress = new Progress<double>(x =>
|
Progress<double> progress = new Progress<double>(x =>
|
||||||
{
|
{
|
||||||
@@ -133,21 +133,32 @@ namespace SanSystem
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
FtpClient client = new FtpClient("192.168.1.2");
|
FtpClient client = new FtpClient("192.168.250.2");
|
||||||
client.Credentials = new System.Net.NetworkCredential("damian", "bodde05");
|
client.Port = 21;
|
||||||
|
client.DataConnectionType = FtpDataConnectionType.AutoActive;
|
||||||
|
client.Credentials = new System.Net.NetworkCredential("default", "default");
|
||||||
client.Connect();
|
client.Connect();
|
||||||
//client.ListingParser = FtpParser.UnixAlt;
|
//client.ListingParser = FtpParser.UnixAlt;
|
||||||
|
|
||||||
ListFiles(client, "/");
|
ListFiles(client, "/at0/");
|
||||||
|
FtpClient newClient = null;
|
||||||
foreach (string file in filenames)
|
foreach (string file in filenames)
|
||||||
{
|
{
|
||||||
|
newClient = new FtpClient("192.168.250.2");
|
||||||
|
newClient.Port = 21;
|
||||||
|
newClient.DataConnectionType = FtpDataConnectionType.AutoActive;
|
||||||
|
newClient.Credentials = new System.Net.NetworkCredential("default", "default");
|
||||||
|
|
||||||
|
if (newClient.IsConnected)
|
||||||
|
{
|
||||||
|
newClient.Connect();
|
||||||
|
}
|
||||||
string[] _tdateiname = file.Split('/');
|
string[] _tdateiname = file.Split('/');
|
||||||
string dateiname = _tdateiname[_tdateiname.Length - 1];
|
string dateiname = _tdateiname[_tdateiname.Length - 1];
|
||||||
string ordner = _tdateiname[_tdateiname.Length - 2];
|
string ordner = _tdateiname[_tdateiname.Length - 2];
|
||||||
|
|
||||||
await client.DownloadFileAsync(Path.Combine(destinationPath, ordner, dateiname), file, true, FluentFTP.FtpVerify.None, progress);
|
newClient.DownloadFile(Path.Combine(destinationPath, ordner, dateiname), file);
|
||||||
client.DeleteFile(file);
|
//client.DeleteFile(file);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,7 +180,8 @@ namespace SanSystem
|
|||||||
|
|
||||||
private void ListFiles(FtpClient client, string directory)
|
private void ListFiles(FtpClient client, string directory)
|
||||||
{
|
{
|
||||||
foreach (FtpListItem item in client.GetListing(directory))
|
client.ListingParser = FtpParser.Unix;
|
||||||
|
foreach (FtpListItem item in client.GetListing(directory, FtpListOption.ForceNameList))
|
||||||
{
|
{
|
||||||
if (item.Type == FtpFileSystemObjectType.File)
|
if (item.Type == FtpFileSystemObjectType.File)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user