private List<String> getFileList(String path){ //存放读取出文件的地址路径 List<String> fileLists = new ArrayList<>(); try { //获取path路径下的内容(文件和文件夹) FTPFile[] files = ftpClient.listFiles(path); for (int i = 0; i < files.length; i++) { FTPFile file = files[i]; if (file.isFile()) { //获取文件或文件夹名称 String saveAsFileName = file.getName(); String filePath = path + saveAsFileName; fileLists.add(filePath); }else if (file.isDirectory()){ //子文件夹下的文件夹路径 String childLists = path + file.getName()+ "/"; List<String> fileList = getFileList(childLists); this.insertData(fileList); } } } catch (IOException e) { e.printStackTrace(); } return fileLists; }