我在获取目录中的最新文件数量方面遇到了麻烦.这些文件正在从PDFCreator打印并发送到该文件夹.当文件夹中的文件数与正在打印的文件数相匹配时,它应该中断并继续我的代码.问题是计数没有保持uptodate,我不知道如何刷新它.这是我的代码:
System.IO.DirectoryInfo pdf = new System.IO.DirectoryInfo(@"C:\0TeklaBatchProcess\pdf");
int count = pdf.GetFiles().Length;
while (count != DE.GetSize())
{
if (count < DE.GetSize())
{
pdf.Refresh();
}
else
{
break;
}
}
Run Code Online (Sandbox Code Playgroud)
如果有人可以告诉我如何刷新或更新文件数量,我会非常感激.