Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
5k views
in Java FTP by (820 points)
I have a JList which lists all the files and folders on my FTP Server, which I can navigate through. At the moment I can download a single file by selecting it. However, I wish to be able to select a folder and download the full contents of it, which may contain multiple subdirectories and files.

I know you can detect whether an item is a file or folder using dirDetails(), but I'm looking for a shortcut that will allow me to download all my files and folders from a directory in one go?

5 Answers

0 votes
by (162k points)
This is supported in edtFTPj/PRO (a commercial product), not in edtFTPj.

For the API, see

http://www.enterprisedt.com/products/ed ... lient.html

For more info about edtFTPj/PRO see

http://www.enterprisedt.com/products/ed ... rview.html



I know you can detect whether an item is a file or folder using dirDetails(), but I'm looking for a shortcut that will allow me to download all my files and folders from a directory in one go?
0 votes
by (820 points)
I have attempted to create my own mass download subroutine however, upon executing this subroutine I have found that I can only download 18 items in one go (there are 42 files in the folder) before the ftp connection disconnects itself. Is there a limit to how many items you can pass through get(localPath, remotePath) in edtFTPj?

A simplified version of my code is shown below:

for(int i=0;i<files[i].length;i++)
{
  ftp.get(local+"\\"+files[i].getName(),files[i].getName());
}
0 votes
by (162k points)
If you search the forums you'll find numerous posts on this problem. Essentially, the client machine runs out of sockets. You need to build in waits during the download process - see our API for an example.

I have attempted to create my own mass download subroutine however, upon executing this subroutine I have found that I can only download 18 items in one go (there are 42 files in the folder) before the ftp connection disconnects itself. Is there a limit to how many items you can pass through get(localPath, remotePath) in edtFTPj?

A simplified version of my code is shown below:

for(int i=0;i<files[i].length;i++)
{
  ftp.get(local+"\"+files[i].getName(),files[i].getName());
}
0 votes
by (820 points)
Thanks for the quick reply.

Ok, I've added a sleep command
Thread.sleep(x)
and it appears to work, but obviously runs very slow. My program is an Applet so reducing the TIME_WAIT on the client machine is not not an option. Is there anyway of adjusting the time within the code?
0 votes
by (820 points)
nvm, just read the api for edtjpro. You handle clearing sockets in there, but if anyone knows away of doing this, it would be much appreciated.

Categories

...