private async Task ListFolderAsync(string path, List <Blob> container, ListOptions options) { IEnumerable <FileInfo> objects; try { objects = await _dbfs.List(StoragePath.Normalize(path)).ConfigureAwait(false); } catch (ClientApiException ex) when(ex.StatusCode == HttpStatusCode.NotFound) { objects = new List <FileInfo>(); } List <Blob> batch = objects .Select(DConvert.ToBlob) .Where(options.IsMatch) .Where(b => options.BrowseFilter == null || options.BrowseFilter(b)) .ToList(); container.AddRange(batch); if (options.Recurse) { await Task.WhenAll(batch.Where(b => b.IsFolder).Select(f => ListFolderAsync(f.FullPath, container, options))).ConfigureAwait(false); } }
private async Task ListFolderAsync(string path, List <Blob> container, ListOptions options) { IEnumerable <FileInfo> objects = await _dbfs.List(StoragePath.Normalize(options.FolderPath, true)); List <Blob> batch = objects.Select(DConvert.ToBlob).ToList(); container.AddRange(batch); if (options.Recurse) { await Task.WhenAll(batch.Where(b => b.IsFolder).Select(f => ListFolderAsync(f.FullPath, container, options))); } }