I have a C# windows service watching a folder. It seems like if files are created using the traditional windows file name structure, everything is fine, e.g. foo.zip. But then along comes one of those pesky unix people who name their files: foo.bar.11-10-2013.zip.
File Watcher in my program never sees this file. There is no filter set, so it is defaulting to *.*
.
If I rename the file to remove the dots and replace them with underscores, the file watcher sees the file.
I tried googling an answer but my other problem is I'm not sure how to state the question - do we call it multiple extensions or multiple dots or multiple periods? All of these returned unhelpful results.
So my question: Is it possible to set up a file watcher to detect linux style file names with multiple dot extensions on it? And if you happen to know a formal term for "multi-dot file extensions", I'd love to know what they are called.
I've decided the answer is that you can't, at least not without a lot of work. I pondered a timer that renames multi-dot files every few seconds, but that seems shabby.
I had the file watcher set to fire when files are created - which is what you get when you drag the control on to the design surface.
I changed the event to detect changes, and I filtered on size. It seems that . precludes "multi-dot" file extensions, and why wouldn't it? foo.bar.blah.zip doesn't fit the . pattern. What we need are ant-like file pattern descriptors (since nobody offered up a better term :-), but those don't seem to be supported via the documentation.
By having it watch for changes in file sizes seems to fire when files are created (going from zero to something) which is good enough for me. Once I know the file is there, I can get its name regardless of the control's filter.