Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.8k views
in Java FTP by (300 points)
Hi!

I want to get all directories under a specified directory.

Using com.enterprisedt.net.ftp.FTPClient.dir will return all entries (directories and files).

I want to filter so that I only receive directory names.

Should I use a filemask? If so where can I find more information.

1 Answer

0 votes
by (300 points)
I dont know why I did not find the solution earlier :-( (before posting this thread)

FTPFile contents[] = ftp.dirDetails("/");               

System.out.println("Listing Directories");
System.out.println("-------------------\n\n");

for (int i = 0; i < contents.length; i++)
{
   if (contents[i].isDir())
      System.out.println(contents[i].getName() + " ***** " + contents[i].getPath());
}

Categories

...