Indeed, the standard pub.client.ftp:ls and pub.client.ftp:dir commands only return file names, no details on the files. You could try to accomplish your requirement using the pub.client.ftp:quote service. This service allows you to issue custom commands on the ftp server. You can issue a ls command with full details and parse the response the server returns.
You’re right. the result for the LS command is returned via the data port, while the quote command does not use data connections. This causes the error (also if you issue a “quote ls” command from a command line ftp session).
While creating the file on the FTP server create it with date_stamp as filename prefix or suffix. List all the files with ‘ls’ or ‘cdls’ and then loop over the list and get only those that macthes the current date ( precalculated and stored in a string ) . OR You may use a filename filter with dates . While getting the file you may use seperate filename ( target filename ) to remove the date_time stamp.
This works good while fetching the files for current date or any date near to the current date .
We cannot modify the file name according to date time stamp.
We are trying to implement pub.client.ftp:quote service passing the parameters LIST after PASV. It takes long time to reply back and gives output as ABOR i.e. abort from FTP.
Create a Java service in webMethods to execute the script:
try{
Process proc = Runtime.getRuntime().exec("cmd /c d:\\ftpls.bat");
int exitVal = proc.waitFor();
}
catch(Throwable t){
throw new ServiceException(t);
}
Now if you call the service, the batch file will be executed on the webMethods machine. The batch file will log on to the remote ftp server (with the username and password from ftpscript.txt), change to the right directory and list the contents. The output of the ftp commands will be written to ftpoutput.txt.
When this service completes, you can read and parse the file ftpoutput.txt which contains the result of the ftp commands.
The same approach can be used on other platforms, but you will of course need to modify it accordingly.