我是新來C#
的號碼,我需要添加一個方法來已經是相當不錯編譯的程序的幫助。方法獲取文件的路徑和文件內它
我有以下代碼:
class Program
{
private static readonly ILog log =
LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
static void Main(string[] args)
{
var startTimeOfApplication = DateTime.Now;
Helper.SetFileAppenderLogFile();
Console.WriteLine("Started executing the MPL File processor at :: " + startTimeOfApplication);
log.Info("Started exection at :: " + DateTime.Now);
var filesPath = string.Empty;
if (args.Length > 0)
{
filesPath = args[0];
}
else
{
filesPath = ConfigurationManager.AppSettings["mplFilesPath"].ToString();
}
log.Info("MPL Files Path " + filesPath);
var mplFilesProcessor = new MPLFilesProcessor();
mplFilesProcessor.ProcessMPLFiles(filesPath);
var endTimeOfApplication = DateTime.Now;
Console.WriteLine("Completed MPL Files Processor exection at :: " + endTimeOfApplication);
log.Info("Completed MPL Files Processor exection at :: " + endTimeOfApplication);
log.Info(string.Format("Total time taken to process is {0} minutes ", endTimeOfApplication.Subtract(startTimeOfApplication).TotalMinutes));
}
我必須保存到String
變量目錄的路徑,我想那路徑和計數的文件數量內的。
請幫助我應該如何去寫那個方法?
感謝幫助!
[從文件夾中的文件數]的可能的複製(http://stackoverflow.com/questions/2242564/file-count-from-a-folder) –
你嘗試過什麼? – ItamarG3
沒有代碼,你的問題已經很清楚了。考慮將它完全從問題中刪除,因爲它很混亂。 –