Solved

Trouble with filesystemwatcher

Posted on 2014-01-16
2
199 Views
Last Modified: 2014-01-16
I'm creating a filewatcher, and even though I set the filter to a specific file extension, the rename event is triggered when the file is changed 'from' that extension that I'm looking for.

Do I have to capture this in my rename event too?

Example:
I'm watching for .filter "*.ABC"

If I rename file.ABC to file.DEF, the rename event is fired.
I only want to process the file if a file is renamed 'to' *.ABC

I know it's possible to simply check that file extension in the rename event, but I wasn't sure if I was overlooking some other setting...
0
Comment
Question by:sirbounty
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 39786124
Sorry for you, but the FileSystemWatcher does not have an option for ExtensionChanged.

What you could do, if you are at ease with the concept, is to build a class that inherits from FileSystemWatcher and code it to add the necessary option.
0
 
LVL 67

Author Comment

by:sirbounty
ID: 39786158
I'll just create a fileinfo reference and check the extension that way then...
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question