Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

dominick

Posts

11

Joined

Fri Oct 19, 2012 9:46 pm

DownloadDirectory implicitly changes the working directory?

by dominick » Fri Oct 19, 2012 10:31 pm

ftpConnection.ChangeWorkingDirectory("/a/b/c");
ftpConnection.DownloadDirectory(localFilePath, "d/e");

I take it that the new working directory will now be /a/b/c/d/e

Is this intentional? Is there any way to avoid this other than placing another ftpConnection.ChangeWorkingDirectory("/a/b/c") statement after downloadirectory one? Thanks in advance.

Dominick Sidiropoulos, Softomotive Ltd.
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: DownloadDirectory implicitly changes the working directo

by support2 » Fri Oct 19, 2012 10:34 pm

Have you tried it? I think the cwd will be /a/b/c
no avatar
User

dominick

Posts

11

Joined

Fri Oct 19, 2012 9:46 pm

RE: DownloadDirectory implicitly changes the working directo

by dominick » Fri Oct 19, 2012 11:49 pm

SecureFTPConnection ftpConnection = new SecureFTPConnection();
ftpConnection.************ = "<LicenseInfo>";
ftpConnection.********* = "<LicenseInfo>";

EnterpriseDT.Util.Debug.Logger.CurrentLevel = EnterpriseDT.Util.Debug.Level.ALL;
EnterpriseDT.Util.Debug.Logger.AddAppender(new EnterpriseDT.Util.Debug.FileAppender(Path.Combine(Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString(), @"ftp.txt")));

ftpConnection.Protocol = FileTransferProtocol.SFTP;
ftpConnection.ServerAddress = "ime.groupcbf.com";
ftpConnection.ServerPort = 22;
ftpConnection.ConnectMode = FTPConnectMode.PASV;
ftpConnection.AuthenticationMethod = AuthenticationType.PublicKey;
ftpConnection.UserName = "ubuntu";
ftpConnection.Password = ftpConnection.ClientPrivateKeyPassphrase = @"";
ftpConnection.Timeout = 10000;
ftpConnection.ServerValidation = SecureFTPServerValidationType.None;
ftpConnection.ClientPrivateKeyFile = Path.Combine(Directory.GetParent(System.Reflection.Assembly.GetExecutingAssembly().Location).ToString(), @"PrivateKey.ppk");
// ftpConnection.TransferType = FTPTransferType.ASCII;

ftpConnection.Connect();

string workingDirectory = ftpConnection.WorkingDirectory;
ftpConnection.ChangeWorkingDirectory(@"/home/ubuntu/workspace/source_ime");
workingDirectory = ftpConnection.WorkingDirectory;
ftpConnection.DownloadDirectory(@"C:\groupcbf\ime\test", @"db/vendor/.svn");
workingDirectory = ftpConnection.WorkingDirectory;
ftpConnection.DownloadDirectory(@"C:\groupcbf\ime\test", @"db/vendor/plugins");

My debugger shows that the working directory before the second downloaddirectory statement has been changed to

/home/ubuntu/workspace/source_ime/db/vendor

Hence the second downloaddirectory statement fails unless I manually switch the working directory back to the original one (statement for this not included). Thanks in advance.

P.S.: If you need the generated logs just drop me an email and I will mail them over to you.
P.S.2: I am running this project using .Net2.0 in case this is of any significance
no avatar
User

support2

Posts

3987

Joined

Tue May 18, 2004 8:30 am

Re: RE: DownloadDirectory implicitly changes the working dir

by support2 » Mon Oct 22, 2012 10:57 pm


Who is online

Users browsing this forum: No registered users and 19 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign
cron