Halo2
I am trying to loop through the directories but I cannot seem to get the working directorie to change. What am I missing
static void cgdirectories(string ftpDir)
{
FTPConnection ftp = new FTPConnection();
ftp.Host = "xxx.com";
ftp.Port = 21;
ftp.Username = "xxx";
ftp.Password = "xxx";
ftp.Passive = true;
ftp.ProxyType = sfFTPLib.enumProxyType.ftpProxyTypeNone;
ftp.FTPProxyType = sfFTPLib.enumFTPProxyType.ftpFTPProxyTypeNone;
ftp.Client = "FTP Updater";
ftp.LogFile = "FTPTXR.log";
ftp.ChangeDirectory(ftpDir);
sfFTPLib.enumError err = ftp.Connect();
if(err == sfFTPLib.enumError.ftpErrorSuccess)
{
//if(ftp.ChangeDirectory(ftpDir) == sfFTPLib.enumError.ftpErrorSuccess)
//{
//}
if(ftp.ReadDirectory() == sfFTPLib.enumError.ftpErrorSuccess)
{
FTPDirectory ftpDirectory = ftp.Directory;
ftp.ChangeDirectory(ftpDir);
Console.WriteLine(ftp.WorkingDirectory);
foreach(FTPItem objItem in ftpDirectory)
{
if (Convert.ToString(objItem.Type) == "ftpItemTypeFolder")
{
cgdirectories(objItem.Name);
}
}
}
else
{
if(err == sfFTPLib.enumError.ftpErrorLicense)
System.Console.WriteLine("Please acquire a license from https://www.smartftp.com");
else
System.Console.WriteLine("Connect() failed. LastError = {0}", ftp.LastError);
}
}
}
static void cgdirectories(string ftpDir)
{
FTPConnection ftp = new FTPConnection();
ftp.Host = "xxx.com";
ftp.Port = 21;
ftp.Username = "xxx";
ftp.Password = "xxx";
ftp.Passive = true;
ftp.ProxyType = sfFTPLib.enumProxyType.ftpProxyTypeNone;
ftp.FTPProxyType = sfFTPLib.enumFTPProxyType.ftpFTPProxyTypeNone;
ftp.Client = "FTP Updater";
ftp.LogFile = "FTPTXR.log";
ftp.ChangeDirectory(ftpDir);
sfFTPLib.enumError err = ftp.Connect();
if(err == sfFTPLib.enumError.ftpErrorSuccess)
{
//if(ftp.ChangeDirectory(ftpDir) == sfFTPLib.enumError.ftpErrorSuccess)
//{
//}
if(ftp.ReadDirectory() == sfFTPLib.enumError.ftpErrorSuccess)
{
FTPDirectory ftpDirectory = ftp.Directory;
ftp.ChangeDirectory(ftpDir);
Console.WriteLine(ftp.WorkingDirectory);
foreach(FTPItem objItem in ftpDirectory)
{
if (Convert.ToString(objItem.Type) == "ftpItemTypeFolder")
{
cgdirectories(objItem.Name);
}
}
}
else
{
if(err == sfFTPLib.enumError.ftpErrorLicense)
System.Console.WriteLine("Please acquire a license from https://www.smartftp.com");
else
System.Console.WriteLine("Connect() failed. LastError = {0}", ftp.LastError);
}
}
}