I'm writing a Windows Service that needs to take a file from an FTP folder on the local computer and parse the data in that file, and push it to an external source. The file will be uploaded to the FTP folder at some point from some other party, and I can't predict when the file will be uploaded. I need the service to be able to scan the FTP folder and recognize when the file has been recently uploaded to the server, and kick off the parsing process.
I need some know if there's some way in .NET to be able to detect when a file was put into a directory.
There is a similar question in SO about this here, but it wasn't in regards to writing a windows service. Also, the solution seemed to be to monitor the directory itself, but I tested that idea using the DirectoryInfo class and it doesn't work when looking at the LastWriteTime property. The time of the directory doesn't change when I copy and replace a file in the directory.
Note: I can't rely on the create/modify timestamps on the file, being as I don't know how the other party is generating these files.