javasftpjschapache-commons-io

Make FileAlterationObserver to observe remote directory


How to make FileAlterationObserver to observe a remote directory?

This can accept a String path or a Java File. Both the cases it will look for the directory in local context. I have a directory in remote server file system.

It would be also helpful if anyone tell me how to create a new File object referring to the file in the remote directory.

Example:

File file = new File("remote directory path");

Solution

  • You cannot.

    All you can do is to use JSch (or other) SFTP interface to check for changes in regular intervals yourself.