I have a zip file in a directory which his name dynamicaly changes.
when I click on a button I should be able to get full path of this file plus the name as follow: U:\home\ash\dfi\dfiZipedFile\dfi.zip
public static String getFileFullName(BcfiDownloadPanel bcfiDownloadPanel) {
    File dir = new File("U:\\home\\ash\\dfi\\dfiZipedFile");
    String[] filesList = dir.list();
    if (filesList == null) {
        // Either dir does not exist or is not a directory
    } else {
        for (int i = 0; i < filesList.length; i++) {
            // Get filename of file or directory
            String filename = filesList[i];
        }
    }
    String fileFullName = filesList[0];
    return fileFullName;
}
                public static String getFirstZipFilename(File dir) {        
    for (File file : dir.listFiles()) {
        String filePath = file.getPath();
        if (file.isFile() && filePath.endsWith(".zip")) {
            return filePath;
        }
    }
    return null;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With