public static List listFiles(String folderUrl) throws IOException {
List fileUrls = new ArrayList<>();
URL url = new URL(folderUrl);
try (InputStream inputStream = url.openStream()) {
String htmlContent = IOUtils.toString(inputStream, "UTF-8");
String[] lines = htmlContent.split("\n");
for (String line : lines) {
if (line.contains("<a href=\"")) {
String fileUrl = line.split("<a href=\"")[1].split("\"")[0];
if (!fileUrl.equals("../")) {
fileUrls.add(folderUrl + fileUrl);
}
}
}
}