Archives by Tag 'File System'

Get Current Directory while running as WindowsService

By admin - Last updated: Monday, September 8, 2008

During development, while you run the application as a console application or windows form application, often the code needs to load a specific file within the same folder of the exe assembly resides. The file can be located by using the file name directory since the default location will be the exe’s directory. For instance, […]

C# Watch file system

By admin - Last updated: Thursday, November 1, 2007

using System.IO; public static void WatchFolder() {     FileSystemWatcher fileSystemWatcher = new FileSystemWatcher();     fileSystemWatcher .Path = “C:\\FoldName”;     fileSystemWatcher .NotifyFilter =            NotifyFilters.LastAccess | NotifyFilters.LastWrite             | NotifyFilters.FileName | NotifyFilters.DirectoryName;     fileSystemWatcher .Filter = “*.cs”;     // Add an event […]