How can I monitor a Windows directory for changes?

Use a FileSystemWatcher like below to create a WatcherCreated Event(). I used this to create a Windows Service that watches a Network folder and then emails a specified group on arrival of new files. // Declare a new FILESYSTEMWATCHER protected FileSystemWatcher watcher; string pathToFolder = @”YourDesired Path Here”; // Initialize the New FILESYSTEMWATCHER watcher = … Read more

Given full path, check if path is subdirectory of some other path, or otherwise

DirectoryInfo di1 = new DirectoryInfo(dir1); DirectoryInfo di2 = new DirectoryInfo(dir2); bool isParent = di2.Parent.FullName == di1.FullName; Or in a loop to allow for nested sub-directories, i.e. C:\foo\bar\baz is a sub directory of C:\foo : DirectoryInfo di1 = new DirectoryInfo(dir1); DirectoryInfo di2 = new DirectoryInfo(dir2); bool isParent = false; while (di2.Parent != null) { if (di2.Parent.FullName … Read more

NSFileManager delete contents of directory

E.g. by using a directory enumerator: NSFileManager *fileManager = [[NSFileManager alloc] init]; NSDirectoryEnumerator *enumerator = [fileManager enumeratorAtPath:path]; NSString *file; while (file = [enumerator nextObject]) { NSError *error = nil; BOOL result = [fileManager removeItemAtPath:[path stringByAppendingPathComponent:file] error:&error]; if (!result && error) { NSLog(@”Error: %@”, error); } } Swift let fileManager = NSFileManager.defaultManager() let enumerator = fileManager.enumeratorAtURL(cacheURL, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)