Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
3.1k views
in .NET FTP by
Hello all,

I have a program loop like this; the example is in vb;

public sub executeFtp()
items = fc.Dir(path)

if recursive then
For Each fileOrFolder As FTPFile In Items
If Not fileOrFolder.Dir
Else
End if
Next
else
fc.Get(path)
end if
end sub

The problem with the 2nd last line (fc.get..) is that 'path' might be a folder as well. In that case I want this method to call itself 1 time for this folder (i.e., only download files but no subfolders in that folder). To do that, I have to predetermine whether the specified path is a file or a folder.

What would be the best way to handle this?
Thanks in advance.

3 Answers

0 votes
by (162k points)
Use DirDetails rather than Dir

Hello all,

I have a program loop like this; the example is in vb;

public sub executeFtp()
items = fc.Dir(path)

if recursive then
For Each fileOrFolder As FTPFile In Items
If Not fileOrFolder.Dir
Else
End if
Next
else
fc.Get(path)
end if
end sub

The problem with the 2nd last line (fc.get..) is that 'path' might be a folder as well. In that case I want this method to call itself 1 time for this folder (i.e., only download files but no subfolders in that folder). To do that, I have to predetermine whether the specified path is a file or a folder.

What would be the best way to handle this?
Thanks in advance.
0 votes
by
Use DirDetails rather than Dir


I use DirDetails, this short example was only to demonstrate the situation. What I need though, is a method GetFileDetails(path) that returns a single FTPFile which I can examine.
0 votes
by (162k points)
There isn't one, DirDetails is the one to use.

Use DirDetails rather than Dir


I use DirDetails, this short example was only to demonstrate the situation. What I need though, is a method GetFileDetails(path) that returns a single FTPFile which I can examine.

Categories

...