Whiteboard Overview
-------------------

The images below are `1000 x 750 px, ~130 kB JPEGs` hosted on ImageShack.

* [Internal](http://img684.imageshack.us/img684/3152/internalr.jpg)
* [Global](http://img718.imageshack.us/img718/8249/globalw.jpg)

---

Additional Information
----------------------

I should mention that each user (of the client boxes) will be working straight off the `/Foo` share. Due to the nature of the business, users will never need to see or work on each other's documents concurrently, so conflicts of this nature will never be a problem. Access needs to be as simple as possible for them, which probably means mapping a drive to their respective `/Foo/username` sub-directory.

Additionally, no one but my applications (in-house and the ones on the server) will be using the FTP directory directly.

---

Possible Implementations
------------------------

Unfortunately, it doesn't look like I can use off the shelf tools such as WinSCP because some other logic needs to be intimately tied into the process.

I figure there are two simple ways for me to accomplishing the above on the in-house side.

1. Method one (slow):

	* Walk the `/Foo` directory tree every N minutes.
	* Diff with previous tree using a combination of timestamps (can be faked by file copying tools, but not relevant in this case) and check-summation.
	* Merge changes with off-site FTP server.
2. Method two:

	* Register for directory change notifications (e.g., using `ReadDirectoryChangesW` from the WinAPI, or `FileSystemWatcher` if using .NET).
	* Log changes.
	* Merge changes with off-site FTP server every N minutes.

I'll probably end up using something like the second method due to performance considerations.

---

Problem
-------

Since this synchronization must take place during business hours, the first problem that arises is during the off-site upload stage. 

While I'm transferring a file off-site, I effectively need to prevent the users from writing to the file (e.g., use `CreateFile` with `FILE_SHARE_READ` or something) while I'm reading from it. The internet upstream speeds at their office are nowhere near symmetrical to the file sizes they'll be working with, so it's quite possible that they'll come back to the file and attempt to modify it while I'm still reading from it.

---

Possible Solution
-----------------

The easiest solution to the above problem would be to create a copy of the file(s) in question elsewhere on the file-system and transfer those "snapshots" without disturbance.

The files (some will be binary) that these guys will be working with are relatively small, probably ≤20 MB, so copying (and therefore temporarily locking) them will be almost instant. The chances of them attempting to write to the file in the same instant that I'm copying it should be close to nil.

This solution seems kind of ugly, though, and I'm pretty sure there's a better way to handle this type of problem.

One thing that comes to mind is something like a file system filter that takes care of the replication and synchronization at the IRP level, kind of like what some A/Vs do. This is overkill for my project, however.

---

Questions
---------

This is the first time that I've had to deal with this type of problem, so perhaps I'm thinking too much into it.

I'm interested in clean solutions that don't require going overboard with the complexity of their implementations. Perhaps I've missed something in the WinAPI that handles this problem gracefully?

I haven't decided what I'll be writing this in, but I'm comfortable with: C, C++, C#, D, and Perl.