I am trying to get a filtered list of files from a SFTP server using SSHJ. It works fine without filter but I am not getting any example of filter.
I am using list files like
Map<String, String> map = new HashMap();
map.put("ext", "*.txt");
RemoteResourceFilter filter = null;
PathComponents path = new PathComponents(null, null, null).;
FileAttributes attr = new FileAttributes.Builder().withExtended(map).build();
RemoteResourceInfo rri = new RemoteResourceInfo(path, attr);
filter.accept(rri);
List<RemoteResourceInfo> rs = sftp.ls("/sftpuser1", filter);
System.out.println(rs.size());
for(int i=0; i<rs.size(); i++) {
System.out.println(rs.get(i).getName().toString());
}
Please could you help me with an example of retrieving files with filter?