Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
scanerio there is a folder where file is created in every 2 seconds and now i want when file is not created in 5 mint means delay time then i want alert that file not created
this code is for when any last file is create/modified in folder that file date time displayed in console and i am done with this ..

i want when ev
i try this

What I have tried:

C#
public static void Main()
        {

            while (true)
            {
                try
                {
                    string path = @"C:\Users\Administrator\Desktop\New folder";

                    //if (!File.Exists(path))
                    //{
                    //    File.Create(path);
                    //}
                    //else
                    //{
                    //    File.SetLastWriteTime(path, DateTime.Now);
                    //}
                    DateTime dt = File.GetLastWriteTime(path);
                    Console.WriteLine("the last time {0}", dt);
                    //Console.ReadLine();
                }
                catch (Exception e)
                {
                    Console.WriteLine("The process failed: {0}", e.ToString());
                }

            }
Posted
Updated 10-May-16 1:47am
v5
Comments
Patrice T 10-May-16 14:28pm    
And you have a question ? a problem ?
Nawab Ahmad 5-Jun-18 4:29am    
What ever i have you can't solve it ..so stay back and allow other to answer.
Patrice T 5-Jun-18 4:39am    
A comment do not prevent others from answering.
and unless you have many user accounts, this comment was not for you.

1 solution

Have you tried running this as 'Administrator' ie with elevated privileges ?
 
Share this answer
 
Comments
super_user 10-May-16 7:37am    
no..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900