FtpDLX - Subsesquent ListDir Commands - WeOnlyDo Discussion board

FtpDLX - Subsesquent ListDir Commands (General questions)

by Daniel.Dority, Wednesday, April 16, 2014, 18:01 (3662 days ago)

Hi,

When I first connect with the software, the remote path is set to something like:

"/users/0098"

I call the ListDir method and pass in a folder name of "edit/". This changes the remote path to "edit/", not "/users/0098/edit/" but I still get the files I need. This works great.

Reusing the same open connection, I perform downloads and uploads. To check to ensure the files are uploading correctly, I perform another ListDir command and pass in the "edit/" again. This time around I get a Folder not found exception and DirItems contains zero items.

- If I change my parameter to "/edit/" from "edit/" then I immediately get a folder not found exception. Even on the first run.
- The "/users/0098" folder is set by default after a successful connection.
- I think it is concatenating the remote paths. Using "edit/edit/" instead of just "edit/".

I don't know how to set the report path back to the parent directory. Setting the Remote Path explicitly back to "/users/0098" then calling ListDir("edit/") will fail on the second attempt.

If I disconnect, then connect after each command it works.

What gives?

FtpDLX - Subsesquent ListDir Commands

by wodSupport, Wednesday, April 16, 2014, 18:04 (3662 days ago) @ Daniel.Dority

Daniel,

hi. One of wodFtpDLX requirements is to use full paths, not relative paths. If you specify 'edit/' it may work, depending on current directory. As soon as you change it, and then try to use 'edit/' again it will fail, sicne 'edit' is appended to last change.

I can suggest to read RemotePath value upon connecting, and then append your relative paths to it directly.

So, if RemotePath = "/users/0098/" then you would do

ListDir RemotePath+"edit/"

which will work in all cases during the connection, since full path is specified.

Can you try that?

Regards,
Kreso

FtpDLX - Subsesquent ListDir Commands

by Daniel.Dority, Wednesday, April 16, 2014, 18:15 (3662 days ago) @ wodSupport

This works:

m_RemotePath = "/users/0098";
m_FtpDlx.ListDir(string.Format("{0}/{1}", m_ReportPath, "edit/"));

But this doesn't:

m_RemotePath = "/users/0098";
m_FtpDlx.RemotePath = m_RemotePath;
m_FtpDlx.ListDir("edit/");


What's the difference? The only difference I see is that a command was not yet issued when the remote path was set. Does an underlying internal property get set when it was issued through an actual command? Is there anyway to force it?

FtpDLX - Subsesquent ListDir Commands

by wodSupport, Wednesday, April 16, 2014, 18:18 (3661 days ago) @ Daniel.Dority

Correct.

FtpDLX.RemotePath

doesn't issue anything. Actually, it is used only to allow ListDir (or other commands) to be specified without a path, in which case RemotePath rpoperty is used. So, whenyou issued

FtpDLX.ListDIr ("edit/")

you actually have overwritten RemotePath property.

So, don't keep stuff in that property since it's overwritten in all ListDir/GetFile/etc.. calls. Use your own variable for path construction.

Kreso

FtpDLX - Subsesquent ListDir Commands

by Daniel.Dority, Wednesday, April 16, 2014, 18:24 (3661 days ago) @ wodSupport

This is slowly making sense.

My mindset here was to replicate the default behavior. For instance:

1. FtpDLX connects to my FTP Server.
2. Remote path was defaulted to "/users/0098".
3. ListDir is called with "edit/".
4. Items are returned.

5. ListDir is called with "edit/" again.
6. Zero items are returned.

On step 5 and 6 makes me think that in order to get this to work, I need to setup the perfrom the action from step 2.. Which is to set to the Remote Path back to "/users/0098". But as I now know, this doesn't work.

If there is a way to reset the path back to the default value from when the component first connected then that would be awesome. It would allow me to fix this issue across my wrapper in one place, as opposed to every method call I wrapped the component around.

Otherwise I'll use the method you provided.

FtpDLX - Subsesquent ListDir Commands

by wodSupport, Wednesday, April 16, 2014, 18:27 (3661 days ago) @ Daniel.Dority

Daniel,

yes, there is a way. First forget about "being in some path" completely, since wodFtpDLX doesn't know about relative paths. It always assumes you provided full absolute path, so it doesn't make a difference where it is currently is.

So, when you connect use your own variable

m_RemotePath = FtpDLX.RemotePath

and don't change m_RemotePath after that. In all subsequent calls, add

ListDir m_RemotePath + "edit/"
or
ListDir m_RemtoePath + "something_else/"

etc.. That way you always refer to your folders relative from m_RemotePath that contains your home folder path.

Kreso

FtpDLX - Subsesquent ListDir Commands

by Daniel.Dority, Wednesday, April 16, 2014, 18:29 (3661 days ago) @ wodSupport

Yeah this is what I ended up doing. Works perfectly.

Thanks and the speediness in the responses should earn you guys an award ;-)

Cheers!