ListDir into raw text string ? - WeOnlyDo Discussion board

ListDir into raw text string ? (General questions)

by dtw01, Wednesday, September 27, 2006, 18:16 (6632 days ago)

Is there a way to get back the entire directory listing as a string from the ListDir method?

I would like to parse the directory structure myself.

I know that I can build a string from the ListItems event, but my directory has 26,000 files in it and I don't want to build the string from the ListItems event firing 26,000 times.

I have tried using ListDir(RemotePath, ToStream) method, but the ToStream value is set to nothing after the ListDir method is done. Is the ToStream param only useful for sending the directory list to the screen for a console app, as in your ListDirToScreen demo app or can it somehow be transferred to a string that can be used for manual parsing.

Ultimately I would simply like to get back the directory listing as a raw text string from the server and to some how tell WeOnlyDo component to NOT parse the directory listing.

Is this possible?

If not, could there possibly be a new method created to do this?

Maybe something like: ListDirRaw(RemotePath, ToString, NoParse)

Re: ListDir into raw text string ?

by wodDrazen, Wednesday, September 27, 2006, 20:15 (6632 days ago) @ dtw01

Hi Dave,


When you call ListDir Method for some directory you can call DirItem Object from wodFtpDLX.NET and make collection of files. After you make collection of files you can parse data from that collection.

Here is example:
-------------------------------------
dlx1 = New WeOnlyDo.Client.FtpDLX
coll = New Collection
Dim j As Integer

dlx1.Hostname = your_server_name
dlx1.Login = your_login
dlx1.Password = your_password
dlx1.Blocking = 1
dlx1.Connect()

dlx1.ListDir( /home/test )

For j = 0 To dlx1.DirItems.Count - 1
Debug.Print(dlx1.DirItems.Item(j).Name)
coll.Add(dlx1.DirItems.Item(j).Name)
Next j
-------------------------------------


More help for DirItem Object you can find here:
http://www.weonlydo.com/FtpDLX.NET/Help/WeOnlyDo.Client.FTP~WeOnlyDo.Client.DirItem_fields.html

Hope this helps.


Regards,
Drazen

Re: ListDir into raw text string ?

by dtw01, Wednesday, September 27, 2006, 20:35 (6632 days ago) @ wodDrazen

I would prefer not to have DirItems stucture created/populated at all, as that takes processing time for 26,000 files. I simply want the raw text directory listing that came back from the server put into a string, so that I can populate my own structure based on my own parsing logic.

Is this possible?

Re: ListDir into raw text string ?

by dtw01, Wednesday, September 27, 2006, 20:42 (6632 days ago) @ dtw01

Another reason for this: if the ListDir method can not successfully parse a directory on it's own (which it can not for VMS), then there is no Ftp1.DirItem structure to work with.

Re: ListDir into raw text string ?

by wodDrazen, Wednesday, September 27, 2006, 21:33 (6631 days ago) @ dtw01

Dave,


When you call ListDir Method you have two option to get files:

1. Thru ListItems event. ListItems event will fired containing all the file listed by the server and you can access it using Fileinfo
2.You can use DirItems property to access parsed collection of items from listed directory.

This is how wodFtpDLX.NET works.


Drazen

Re: ListDir into raw text string ?

by wodDrazen, Wednesday, September 27, 2006, 21:47 (6631 days ago) @ wodDrazen

Dave,


Actually you can try to use ListItem Property.

More help you can find here:
http://www.weonlydo.com/FtpDLX.NET/Help/WeOnlyDo.Client.FTP~WeOnlyDo.Client.FtpDLX~ListItem.html

Let us know how it goes


Drazen

Re: ListDir into raw text string ?

by dtw01, Wednesday, September 27, 2006, 22:13 (6631 days ago) @ wodDrazen

I'm pretty sure that this will work. :)

It doesn't stop the DirItems structure from being populated, but does gives me the string I'm asking for without having to build my own via the Ftp1.ListItemsEvent firing 26,000 times.

Thank you!