Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dirctory.move won't fire filesystemwatcher event

Status
Not open for further replies.

cpshadle

Programmer
Joined
Sep 5, 2005
Messages
1
Location
US
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)
{
...
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top