Background:
I have a server app that uses the filesystemwatcher that monitors a target folder and performs some operation on it when a sub-folder appears in it.
(a) When the service is run and I do a cut and paste or copy and paste it works great.
(b) When I move a folder there (drag&drop) however, an event doesn't fire.
Problem:
I have a seperate client app that locates a source folder and does a Directory.Move to move it into a target folder on the server...and because (b) doesn't work, this does not work either.
Question:
How can I get the filesystemwatcher to fire an event when a folder is "MOVED" into a target folder.
Some code:
I've tried to use Created (shown below) and Renamed but neither work. (to rename folder you unfortunately have to use the Copy function --the stinkin culprit?)
Server:
this.SysWatcher.NotifyFilter = (((((
(NotifyFilters.FileName
| NotifyFilters.DirectoryName)
| NotifyFilters.Attributes)
| NotifyFilters.Size)
| NotifyFilters.LastWrite)
| NotifyFilters.LastAccess)
| NotifyFilters.CreationTime)
| NotifyFilters.Security;
SysWatcher.Path = "c:\\mytarget\\";
SysWatcher.Filter = "*.dat";
SysWatcher.Created += new FileSystemEventHandle (this.mySysWatcher_Created);
private void mySysWatcher_Created(object sender, FileSystemEventArgs e)
{
...
}
I have a server app that uses the filesystemwatcher that monitors a target folder and performs some operation on it when a sub-folder appears in it.
(a) When the service is run and I do a cut and paste or copy and paste it works great.
(b) When I move a folder there (drag&drop) however, an event doesn't fire.
Problem:
I have a seperate client app that locates a source folder and does a Directory.Move to move it into a target folder on the server...and because (b) doesn't work, this does not work either.
Question:
How can I get the filesystemwatcher to fire an event when a folder is "MOVED" into a target folder.
Some code:
I've tried to use Created (shown below) and Renamed but neither work. (to rename folder you unfortunately have to use the Copy function --the stinkin culprit?)
Server:
this.SysWatcher.NotifyFilter = (((((
(NotifyFilters.FileName
| NotifyFilters.DirectoryName)
| NotifyFilters.Attributes)
| NotifyFilters.Size)
| NotifyFilters.LastWrite)
| NotifyFilters.LastAccess)
| NotifyFilters.CreationTime)
| NotifyFilters.Security;
SysWatcher.Path = "c:\\mytarget\\";
SysWatcher.Filter = "*.dat";
SysWatcher.Created += new FileSystemEventHandle (this.mySysWatcher_Created);
private void mySysWatcher_Created(object sender, FileSystemEventArgs e)
{
...
}