AbdelHady
AbdelHady

Reputation: 9702

detect newly created files in a remote location using java

I want to detect newly created files in a remote location, so I can process this file (read it, and do some operations on it)

so please, how can I do this using Java 5? (I know it is an old server, but we have problems in upgrading it during recent times)

Note: the way to access the remote file is of our choice depending on the proposed solution (i.e. for example, if the best solution is by using FTP, I'll handle it)

thanks in advance guys.

Upvotes: 0

Views: 1276

Answers (2)

ᴇʟᴇvᴀтᴇ
ᴇʟᴇvᴀтᴇ

Reputation: 12751

Polling with FTP is one way.

An alternative, if you can run some custom code on the remote location, would be to keep a connection open between your client and server (or perform a long-poll) and have the server immediately notify the client of any changes to the files.

Upvotes: 1

Peter Lawrey
Peter Lawrey

Reputation: 533530

The simplest solution is to use the Directory Watcher

This requires Java 7 and the directory be mounted and visible to the user running the process.

Upvotes: 2

Related Questions