public static void Add(this IStreamProvider streamProvider, string sourceFileOrFolderPath, string tableName, CrawlType crawlType, DateTime asOfDateTime = default(DateTime)) { // If the 'asOfDateTime' wasn't passed, use the File Write Time if (asOfDateTime == default(DateTime)) { asOfDateTime = File.GetLastWriteTimeUtc(sourceFileOrFolderPath); } string desiredFolderPath = streamProvider.Path(LocationType.Source, tableName, crawlType, asOfDateTime); if (Directory.Exists(sourceFileOrFolderPath)) { foreach (string filePath in Directory.GetFiles(sourceFileOrFolderPath, "*.*", SearchOption.AllDirectories)) { streamProvider.Copy(File.OpenRead(filePath), System.IO.Path.Combine(desiredFolderPath, System.IO.Path.GetFileName(filePath))); } } else { streamProvider.Copy(File.OpenRead(sourceFileOrFolderPath), System.IO.Path.Combine(desiredFolderPath, System.IO.Path.GetFileName(sourceFileOrFolderPath))); } }