在特定时间检查特定文件夹中是否存在文件 [英] Check the presence of a file in a particular folder at a Particular time
本文介绍了在特定时间检查特定文件夹中是否存在文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在C#中开发了一个应用程序。该应用程序具有以下功能。
1>将有不同的文件夹,输入文件将在不同的时间加载。
2>我们必须在特定时间检查输入文件是否存在于特定文件夹中
例如:每天下午5点检查文件夹X,每天下午6点检查文件夹Y,
我不知道如何开始。你可以请教一下这个怎么办?
解决方案
写windows服务
http://www.aspdotnet-suresh.com/2011/06/creating-windows-service-in-c- or.html [ ^ ]
检查计时器已过时事件中的文件夹或文件是否存在(OnElap服务中的sedTime。
http:// msdn.microsoft.com/en-us/library/system.io.directory.exists.aspx [ ^ ]
http://stackoverflow.com/questions/2570930/check-if-a-file -directory-exists-is-a-better-way [ ^ ]
看一下文件类 [ ^ ]和目录类 [ ^ ]
以下是一些示例文章
使用C#中的文件类 [ ^ ]
使用.Net中的目录类(C#) [ ^ ]
FileInfo file = new FileInfo(yourFullPathOfFile);
if (file.Exists)
{
// < span class =code-comment>是,文件存在
}
其他
{
// 否,文件不存在
}
Hi All,
I got an assignement to develop an application in C#.The application has the following functionality.
1>There will Be different folders ,Input files will be loaded at different time.
2>We have to check whether input file is present in a particular folder at particular time or not
Ex:Check the folder "X"every day at 5 PM,Check the folder "Y"every day at 6 PM,
I dont know how to start ..Could you please advice how to proceed this?
解决方案
Write windows services
http://www.aspdotnet-suresh.com/2011/06/creating-windows-service-in-c-or.html[^]
Check the Folder or File Exists on timer elapsed event (OnElapsedTime) in the service.
http://msdn.microsoft.com/en-us/library/system.io.directory.exists.aspx[^]
http://stackoverflow.com/questions/2570930/check-if-a-file-directory-exists-is-there-a-better-way[^]
Take a look at the File Class[^] and Directory Class[^]
Here are some sample articles
Working With File Class in C#[^]
Working with Directory Class in .Net (C#)[^]
FileInfo file = new FileInfo(yourFullPathOfFile); if(file.Exists) { //yes, file exists } else { //no, file does not exists }
这篇关于在特定时间检查特定文件夹中是否存在文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文