private static ArrayList<File> listFiles(String dirPath) throws FileNotFoundException {
        ArrayList<File> files = new ArrayList<File>();

        File dir = new File(dirPath);
        if (!dir.isDirectory()) {
            throw new FileNotFoundException(dir.getName() + " is not a valid directory");
        }

        File[] filesArray = dir.listFiles();
        if (filesArray.length == 0) {
            throw new FileNotFoundException("No files to merge");
        }

        for (File f : filesArray) {
            if (f.isFile() && (!f.isDirectory()) && f.exists() && (f.length() > Integer.valueOf(Settings.getSetting("minimumFileLengthB"))) && !f.isHidden()) {
                files.add(f);
            }
        }
        return files;
    }