sp; var uploadBackupPath = systemPath + @"/filebackup/"; DeleteFile(uploadBackupPath, 7); var config = new ConfigurationBuilder() .SetBasePath(systemPath) .AddJsonFile("appsettings.json") .Build(); //读取配置 var filePath = config["filePath"]; if (!string.IsNullOrEmpty(filePath)) { Console.WriteLine("当前文件路径:" + filePath); var logName = DateTime.Now.ToString("yyyy-MM-dd") + ".txt"; if (!File.Exists(logPath + logName)) { File.Create(logPath + logName); } using (StreamWriter sw = new StreamWriter(logPath + logName, true)) { try { var files = Directory.GetFiles(filePath); if (files.Length > 0) { |