Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
4.2k views
in .NET FTP by (1.3k points)
FTPConnection.ChangeWorkingDirectory Method
Directory to change to (may be relative or absolute).

The online documentation says that the method accepts an absolute path as the directory parameter.
But it seems that it only accepts an absolute path in the format "/C/subfolder1..." rather than "C:\subfolder1\.."

Is this the expected behaviour?

And one other thing, did anything change between versions 6.0.0 and 8.0.0 w.r.t the way this method works?

Thanks

3 Answers

0 votes
by (162k points)
ChangeWorkingDirectory refers to the remote filesystem, and so it uses the convention used on FTP servers - forward slashes. Some FTP servers do allow backward slashes, and you'll be able to use them in that instance.
0 votes
by (1.3k points)
Thanks for your reply. Just to clarify... when you say that some servers will allow backward slashes, does that mean they will allow a path with the format 'C:\folder\'?
Furthermore, will some servers allow UNC paths '\\Shared\folder1\' or even 'http://Host/Shared' and if so, does ChangeWorkingDirectory handle these?

Also, is there any difference between FtpClient.ChangeWorkingDirectory(target); and FtpClient.ServerDirectory = target; ?

Thanks
0 votes
by (51.6k points)
Some servers allow backslashes to be used instead of forward slashes. For example, our server, CompleteFTP, has an option to allow this. It's not really something we recommend, since it's non-standard, but some people need it for various reasons. Our server also allows colons in folder-names, so it's possible to set up a folder named C: in the virtual file-system. You could therefore emulate Windows paths. They wouldn't be genuine Windows paths though. I can't really speak for what other servers allow. I'm not really sure if CompleteFTP allows double slashes or not. If it does then you would be able to emulate those other paths. Why would you want to do it anyway?

ChangeWorkingDirectory allows you to use relative paths, such as "../mydir", whereas ServerDirectory only permits absolute paths.

- Hans (EnterpriseDT)

Categories

...