Please recommend me some java client library for sftp and ftp that support directory monitoring.
Thank you.
Please recommend me some java client library for sftp and ftp that support directory monitoring.
Thank you.
The most complete is probably Jakarta Commons Net: http://commons.apache.org/net/
There is no FTP command for monitoring a directory. Your application will need to connect, request the directory listing and cache it. Then, periodically, connect, fetch a new listing, and compare it to the cached listing.
Note that FTP servers generally will not let you sit there with an idle connection. So, the proper behavior is to disconnect between checks of the listing.
edtFTPj/PRO is a commercial Java client library that supports SFTP, FTP and FTPS (and SCP).
As another answer notes, you will need to periodically compare the latest listing with the previous one (disconnecting in between attempts).