Automatically split Ftp.ChangeDirectory() path into discrete sections

0 votes
asked Sep 20, 2010 by Jan (140 points)
edited Mar 22, 2011

Hi,

Is it possible for Rebex to extend Ftp.ChangeDirectory() to automatically handle (split if necessary) the directory path so that it always works, on all servers even the ones that don't handle '\' or '/'? Adding a special method for this is also ok.

You're advice on doing this in client code causes a lot of duplication of effort and there is no safe way to change to the ftp root directory (that I know of).

Regards, Jan.

Applies to: Rebex FTP/SSL

1 Answer

0 votes
answered Sep 21, 2010 by Lukas Pokorny (100,910 points)
edited Sep 21, 2010

It might possible to do this, but some problems would remain:

  • How do we detect whether special handling (splitting) is necessary? That might be very tricky. Adding an option to make it possible for the user to explicitly enable this behavior sound easier.

  • If there is no safe way to change to the FTP root directory, then how would we do that? One possible method would be to call CDUP command repeatedly until the directory is unchanged or until it fails, but whether this would be reliable is hard to tell. What if we don't have access rights to one of the intermediate folders?

  • What about other methods? If ChangeDirectory automatically simulated '/' on servers using a different delimiter, users would expect that other methods behave the same way. This would add lot of complexity, because we would have to change to the target folder first, then perform the desired action and then change back to the original folder. I'm not sure the effort would really be worth it.

Any comments are appreciated.

commented Oct 1, 2010 by Jan (140 points)
* I'm assuming that Rebex could get enough info from the connect/login/feature to determine if the special handling is needed? * The change to the root is part of the workaround... Normally I navigate relatively through the directories. * I can't speak for others, but I always get/put files from the current ftp directory. I specifically use ChangeDirectory to manage the directory tree, to simplify usage. I would like Rebex to handle all these details for me, like the '/' vs '\', in a single place (i.e. the library). Instead of me having to think about it over and over again...
...