Recursively list files and directories in an FTP server using Java
问题 I'm currently using a Java FTP library (ftp4j) to access a FTP server. I want to do a file count and directory count for the server, but this means I would need to list files within directories within directories within directories, etc. How is this achievable? Any hints would be greatly appreciated. Extract from the code: client = new FTPClient(); try { client.connect(""); client.login("", ""); client.changeDirectory("/"); FTPFile[] list = client.list(); int totalDIRS = 0; int totalFILES = 0