void _worker_DoWork(object sender, DoWorkEventArgs e) { foreach (var directory in GetPartiallyFlatDirectories(_searchPath, 4)) { if (_worker.CancellationPending) { break; } foreach (var file in directory.GetFiles(_template, SearchOption.AllDirectories)) { FileFound.Raise(file); } } }