473,382 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

directory watcher ?

..2003 have a filesystemwatcher ...

does it have a directorysystemwatcher ? What i need is to watch whether
directory is deleted ?

i assume filesystemwatcher delete method is for file, not directory.

Pls advise
Nov 21 '05 #1
3 2974
Hi,

The filesystemwatch will watch directories.

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
------------------
"James" <jk****@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP15.phx.gbl...
.2003 have a filesystemwatcher ...

does it have a directorysystemwatcher ? What i need is to watch whether
directory is deleted ?

i assume filesystemwatcher delete method is for file, not directory.

Pls advise

Nov 21 '05 #2
does it watch a directory being DELETED ?

i thot filewatch only watch FILES within subdirectory.

More concern is DIRECTORY itself being deleted.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
Hi,

The filesystemwatch will watch directories.

http://msdn.microsoft.com/library/de...classtopic.asp
Ken
------------------
"James" <jk****@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP15.phx.gbl...
.2003 have a filesystemwatcher ...

does it have a directorysystemwatcher ? What i need is to watch whether
directory is deleted ?

i assume filesystemwatcher delete method is for file, not directory.

Pls advise


Nov 21 '05 #3
Hi,

Watch the directories parent for the directory being delete.
Simple example needs 2 buttons (btnDelete and btnAdd), a filesystemwatcher,
and listbox.

Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Directory.CreateDirectory("C:\Watch me")
FileSystemWatcher1.Path = "C:\Watch me"
FileSystemWatcher1.IncludeSubdirectories = True

End Sub

Private Sub FileSystemWatcher1_Created(ByVal sender As Object, ByVal e
As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Created
Dim strOut As String

strOut = String.Format("Created {0}", e.Name)
ListBox1.Items.Add(strOut)
End Sub

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
Try
Directory.CreateDirectory("C:\Watch me\Delete me")
Catch ex As Exception

End Try
End Sub

Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnDelete.Click
Try
Directory.Delete("C:\Watch me\Delete me")
Catch ex As Exception

End Try
End Sub

Private Sub FileSystemWatcher1_Deleted(ByVal sender As Object, ByVal e
As System.IO.FileSystemEventArgs) Handles FileSystemWatcher1.Deleted
Dim strOut As String

strOut = String.Format("Deleted {0}", e.Name)
ListBox1.Items.Add(strOut)

End Sub
End Class
Ken
--------------------
"James" <jk****@hotmail.com> wrote in message
news:uD**************@TK2MSFTNGP14.phx.gbl...
does it watch a directory being DELETED ?

i thot filewatch only watch FILES within subdirectory.

More concern is DIRECTORY itself being deleted.

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OB**************@TK2MSFTNGP09.phx.gbl...
Hi,

The filesystemwatch will watch directories.

http://msdn.microsoft.com/library/de...classtopic.asp

Ken
------------------
"James" <jk****@hotmail.com> wrote in message
news:OT**************@TK2MSFTNGP15.phx.gbl...
> .2003 have a filesystemwatcher ...
>
> does it have a directorysystemwatcher ? What i need is to watch whether
> directory is deleted ?
>
> i assume filesystemwatcher delete method is for file, not directory.
>
> Pls advise
>
>



Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: yasir | last post by:
I am using Watcher to detect any file renamed event. From time to time, or when lot of files gets renamed at the same time, Watcher fails to detect some files. I have set the InternalBuffereSize to...
2
by: Marcelo López | last post by:
Hi all. I'm developing a Windows Explorer like app. I have my own repository to store the files and a bd where i keep the path to each file. I have to watch the repository all time to avoid...
0
by: JIM.H. | last post by:
Hello, I am calling this sub to start watcher. It seems if the network drive went down and came back, watcher is not checking the file anymore. What is the secure way to stop it and call this sub...
1
by: Iris | last post by:
I have a directory which I want to be watched by the file- watcher. Now I have a question. I want this directory to be selected once and then be safed so that everytime I start the program I dont...
4
by: Marcelo López | last post by:
Hi all. I'm developing a Windows Explorer like app. I have my own repository to store the files and a bd where i keep the path to each file. I have to watch the repository all time to avoid...
1
by: R.A. | last post by:
Hi I have a class which contains a datagrid and a file watcher object. When the file watcher event is triggered then in the event handler I add rows to the data grid. the problem is that every...
3
by: Nick | last post by:
Is it possible to read a list of files from a specified directory using VB.net We have company intranet and I have created a page that displays photos from different events. I have coded a page...
3
by: Nathan Sokalski | last post by:
I have several pieces of data that I use the HttpApplicationState for, because they rarely change and are used by everyone. When these pieces of data are created, they are created either from...
1
by: =?Utf-8?B?QXZp?= | last post by:
Hi I have an interesting issue, I hope someone can shead light on: I have a 2 server "web farm" with a web app that produces image files. To ensure synchronization of content on both machines,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.