0

Please recommend me some java client library for sftp and ftp that support directory monitoring.

Thank you.

robinmag
  • 17,520
  • 19
  • 54
  • 55

4 Answers4

5

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.

Devon_C_Miller
  • 16,248
  • 3
  • 45
  • 71
2

There is an open source library rdp4j which allows to poll for any remote directory.

All that you have to do is to implement adapter for reading from FTP or SFTP server.

Community
  • 1
  • 1
-1

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).

Bruce Blackshaw
  • 986
  • 1
  • 7
  • 10
-2

The most complete is probably Jakarta Commons Net: http://commons.apache.org/net/

Carlos Tasada
  • 4,438
  • 1
  • 23
  • 26
  • does it have the folder and file monitoring functionality ? Thanks – robinmag Jan 26 '10 at 17:14
  • Robin, AFAIK the Commons Net doesn't have file monitoring support, but if you need this functionality, check here: http://stackoverflow.com/questions/1096404/is-there-a-sophisticated-file-system-monitor-for-java-which-is-freeware-or-open-s I hope it helps. – Carlos Tasada Jan 27 '10 at 09:59