Hello,
I'm using FTPClient to access a remote FTP server and get a subset of
files contained into its directory, the following is an exctract from my
code:
FTPClient ftpcl = new FTPClient();
ftpcl.connect(remotehost);
if(!FTPReply.isPositiveCompletion(ftpcl.getReplyCode())) {
// ERROR
}
if(!ftpcl.login(remoteuser, remotepassword)) {
// ERROR
}
ftpcl.noop();
if(!ftpcl.changeWorkingDirectory(remotedir)) {
// ERROR
}
FTPListParseEngine engine = ftpcl.initiateListParsing();
while (engine.hasNext()) {
FTPFile[] files = engine.getNext(50);
for(FTPFile file : files) {
if(fileOK(file)) {
FileOutputStream fos = new FileOutputStream( dst );
if(!ftpcl.retrieveFile( file.getName(), fos )) {
// ERROR
}
}
}
}
The problem is that on remote directory there are a lot of files that I
don't need to download (they have a different file name from the file I
need to download); until now I have used my method fileOK(FTPFile) to
check each file returned by initiateListParsing();
so my question is: is it possible to filter the file returned by
initiateListParsing() using a regular expression ?
Thanks in advance and Best Regards.