private boolean isFileValid(File f){
        if (f.isDirectory())
            return true;
        for (String s: validFormats){
            if (extension(f).equalsIgnoreCase(s))
                return true;
        }
        return false;
    }