How can I get the window directories being accessed by user in C# on Windows 7?
I do have a list of recent directories here but it is not realtime. Also when I start my system the list is empty.
RegistryKey reg = Registry.CurrentUser;
reg.GetValue(@"Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths")
Following location has recently used documents C:\Users\UserName\AppData\Roaming\Microsoft\Windows\Recent
Environment.GetFolderPath(Environment.SpecialFolder.Recent)
Is there a library in .Net 3.5 which raises an event whenever a directory is being accessed. I tried using
public void CreateWatcher()
{
//Create a new FileSystemWatcher.
FileSystemWatcher watcher = new FileSystemWatcher();
watcher.Filter = "*.*";
/* Watch for changes in LastAccess and LastWrite times, and
the renaming of files or directories. */
watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.DirectoryName;
//Set the path to C:\Temp\
watcher.Path = "C:\\";
watcher.IncludeSubdirectories = true;
watcher.Changed += new FileSystemEventHandler(watcher_Changed);
//Enable the FileSystemWatcher events.
watcher.EnableRaisingEvents = true;
}
void watcher_Changed(object sender, FileSystemEventArgs e)
{
Console.WriteLine("FullPath " + e.FullPath);
}
Is there a way to get directory name which is being accessed by windows explorer? All I need is full name of the directory being accessed by user.