Method similler to File.Exists() for this componet - WeOnlyDo Discussion board

Method similler to File.Exists() for this componet (General questions)

by pp, Wednesday, October 08, 2008, 23:40 (5889 days ago)

Hi,
I want to check the existance of the file on ftpfolder. I tried the File.Exists(FTPFolderath) but it won't work. Is this component have similler method which I can use. Thnaks

Re: Method similler to File.Exists() for this comp

by pp, Wednesday, October 08, 2008, 23:48 (5889 days ago) @ pp

Forgot to mention that I am taking about the wodFtpDLX.NET

Hi,
I want to check the existance of the file on ftpfolder. I tried the File.Exists(FTPFolderath) but it won't work. Is this component have similler method which I can use. Thnaks

Re: Method similler to File.Exists() for this comp

by wodDamir, Wednesday, October 08, 2008, 23:52 (5889 days ago) @ pp

Hi,

Unfortunately, method like that doesn't exsist. Hovever, i would suggest that you try listing a directory and check if a file exist or not.

You can do that, either by using diritems collection, or using loopfiles method and loopitems event.

Can you please try one of these methods?

Regards,
Damba

Re: Method similler to File.Exists() for this comp

by pp, Thursday, October 09, 2008, 00:50 (5889 days ago) @ wodDamir

Thanks !!
It would be great help if you could tell me how to use diritems ,loopfiles or ListDir.

Re: Method similler to File.Exists() for this comp

by wodDamir, Thursday, October 09, 2008, 09:00 (5888 days ago) @ pp

Hi,

Ok, ListDir is used by simply providing is remotepath. Something like this:

[code]wodFtp1.ListDir /home/user/ [/code]

This method will list all the files and directories in that path. Also, as a result it will fire ListItems event,which will provide you directory listing as String.

More information here: http://www.weonlydo.com/FtpDLX/Help/wodFtpDLXLib~wodFtpDLX~ListItems_EV.html

As a result of ListDir method, DirItems collection is also populated with all the files/directories. You can then iterate thru each of them, something like this:

[code]Dim folderItem as DirItem
For each folderItem in wodFtp1.DirItems
Debug.Print folderItem.Name
Next[/code]


LoopFiles also accepts remotepath parameter. However, as a result of this method, LoopItem event is fired for each item (directory, file etc.). Using this event, you can use RemoteFile parameter to check if this is the file you are looking for.

You can find more information on this event here: http://www.weonlydo.com/FtpDLX/Help/wodFtpDLXLib~wodFtpDLX~LoopFiles.html

Hope this helps.

Regards,
Damba