using System;
using System.IO;
using System.Collections.Generic;
namespace files_module
{
class Program
{
static void Main(string[] args)
{
var salesFiles = FindFiles("stores");
foreach (var file in salesFiles)
{
Console.WriteLine(file);
}
}
/// 查找文件
static IEnumerable<string> FindFiles(string folderName)
{
List<string> salesFiles = new List<string>();
var foundFiles = Directory.EnumerateFiles(folderName, "*", SearchOption.AllDirectories);
foreach (var file in foundFiles)
{
// The file name will contain the full path, so only check the end of it
if (file.EndsWith("sales.json"))
{
salesFiles.Add(file);
}
}
return salesFiles;
}
}
}