DirectoryWatcher question

  • Thread starter Thread starter DorkyGrin
  • Start date Start date
D

DorkyGrin

Can DirectoryWatcher watch subdirectories, copy files that appear,
change the name of the files, and send those files to another
specified directory? I'm doing this now with a VBS script and using
Windows scheduler to kick off the process. Seems like DirectoryWatcher
would do this nicely and speed up things a bit.

Thanks for any ideas.
 
Can DirectoryWatcher watch subdirectories, copy files that appear,
change the name of the files, and send those files to another
specified directory? I'm doing this now with a VBS script and using
Windows scheduler to kick off the process. Seems like DirectoryWatcher
would do this nicely and speed up things a bit.

Thanks for any ideas.

I actually wrote a similar service that watches the My Documents ->
Visual Studio 2005 folder and automatically backs up my projects to my
network server whenever I make changes. Mainly all you need to do is
set the Path and IncludeSubdirectories properties and then handle the
necessary events (like "Created", "Deleted", "Changed", etc). Then
just add the code in the event handlers that does the actual work
(like copying the file/folder to a new directory)

BTW, the commands for copying, renaming, and moving files and folders
are in the System.IO.File and System.IO.Folder classes.

Thanks,

Seth Rowe
 
Dont quote me on this...but there is some extra code you might have to do if
it is a network drive and the drive gets disconnected and then reconnected.

If i read something correctly back in the day...the event fires when you
reconnect when actually there have been no changes.

-Again...i might have read that wrong.

Cheers

Miro
 
Back
Top