How to make a folder in Windows Explorer activate an external application?

I need to create an application that when the user copies a file to a specific folder, my application will be activated and the file will be modified, also when the user reads back any file in the folder, the changes will also be made to the file.

Is it possible?

I will be using .net for this.

I think the C: \ WINDOWS \ assembly folder looks like this anyway?

Any help would be appreciated! Thank!

0


source to share


4 answers


Well, I'm sure you could write an explorer extension that would do that, but in a more typical method, which I know is to write a Windows service that monitors the directory in question, using the FileSystemWatcher class to monitor events. The service can then perform the requested actions (or create an executable to do so).

One caveat I noticed is that sometimes the file watcher can skip events if there is a lot of activity going on (since .net 2.0 - didn't check 3.5).



If you use this method, make sure you check the directory contents yourself when you receive a change notification, rather than relying on what the file manager tells you. I ended up combining filewatcher event handling with sparse polling to make sure I wasn't missing anything.

+2


source


You may find that users copy files to a folder using a service that uses FileSystemWatcher. Changing the contents of a file while an application reads the file requires viral techniques that fix the operating system. As a rootkit or file system filter driver. Not what I recommend considering, modify the file after writing it.



c: \ windows \ assembly contains GAC..NET installs a wrapper extension handler that hides the contents of the folder. Otherwise, the folder is quite accessible, the shell extension handler only works when browsing the folder using Windows Explorer. Writing wrapper extension handlers with .NET is heavily discouraged by Microsoft, and the framework lacks support as well.

+1


source


You can track changes using FileSystemWatcher .

You can configure a component to view an entire directory and its contents, or a specific file or set of files within a given directory. The FileSystemWatcher component raises an event when a file or subdirectory in the specified root directory is created, deleted, renamed, or otherwise modified. Change types that track components including changes to a file or subdirectory attributes, size, last write time, last access time, and security settings.

0


source


The closest you will get .net is the FileSystemWatcher class, it will track changes (create and write) but not for read activity.

There are many examples online and on MSDN

http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

0


source







All Articles