How do you check for a newly created file. This only works for an edited file.
DateTime time = DateTime.Now; // Use current time
string format = "dMyyyy"; // Use this format
string s = time.ToString(format);
fileSystemWatcher1.Path = @"C:\Users\Desktop\test\";
fileSystemWatcher1.NotifyFilter = NotifyFilters.LastAccess |
NotifyFilters.LastWrite |
NotifyFilters.FileName |
NotifyFilters.DirectoryName;
fileSystemWatcher1.IncludeSubdirectories = false;
fileSystemWatcher1.Filter = s + ".txt";
Following the example outlined in this article C#: Application to Watch a File or Directory using FileSystem Watcher
You need to describe what has to be done when one of these attributes in
fileSystemWatcher1.NotifyFiltergets altered by assigning different event handlers to different activities. For example:With the signatures of both the handlers as
Example handler for
OnChangedAnd then enable the watcher to raise events: