You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

How to subscribe to file changes?

In order to retrieve the notifications about the file changes located in a given directory use a ForFolder method.

Syntax

IObservableWithTask<FileChangeNotification> ForFolder(string folder);

Parameters
folder string The name of a directory for which notifications will be sent.

Return Value
IObservableWithTask<FileChangeNotification> The observable that allows to add subscriptions to received notifications

Example

IDisposable subscribtion = store
	.Changes()
	.ForFolder("/documents/books")
	.Subscribe(change =>
	{
		switch (change.Action)
		{
			case FileChangeAction.Add:
				// do something
				break;
			case FileChangeAction.Delete:
				// do something
				break;
		}
	});

Remarks

Information

To get more method overloads, especially the ones supporting delegates, please add Reactive Extensions package to your project.