Here is a scenario what I want to do and need some ideas about proceeding.

I have a directory where the files are being added every 5 to 10 seconds. These files are to be transferred one at a time to some other location using some kind of secure protocol. The party receiving files will process each file and send the response back instantaneously. The send and response for each file is between 2 to 4 seconds. The response file is saved in a separate directory. If a successful response then sends another file and so on.

The program iterates through the directory and if any files will send if no files wait for 10 seconds and check if any files to send and will run as long as someone manually shuts down. What's the better way to achieve this functionality.

Any ideas the best approach and where to start. Thanks