473,799 Members | 3,218 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logging

I have the code below and it does what i want except for one thing and I
can't for the life of me figure it out. It makes multiple copies of the
entries in the Event Log and sends multiple emails. I would appreciate
any help in figuring out what is going on.

Thanks.
---- Begin Code ----
Imports System
Imports System.IO
Imports System.Diagnost ics
Imports Microsoft.Win32
Imports System.Web.Mail
Public Class Form1
Inherits System.Windows. Forms.Form

Public watchfolder As FileSystemWatch er
Public exeWatcher As FileSystemWatch er
Public batWatcher As FileSystemWatch er
Public scrWatcher As FileSystemWatch er
Public m As New System.Web.Mail .MailMessage()

Public strComputer As String
Public strUser As String
Public strLogMsg As String
#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeCompo nent()

'Add any initialization after the InitializeCompo nent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.Componen tModel.IContain er

'NOTE: The following procedure is required by the Windows Form
Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Label1 As System.Windows. Forms.Label
Friend WithEvents txt_watchpath As System.Windows. Forms.TextBox
Friend WithEvents btn_startwatch As System.Windows. Forms.Button
Friend WithEvents btn_stop As System.Windows. Forms.Button
Friend WithEvents Label2 As System.Windows. Forms.Label
Friend WithEvents txt_folderactiv ity As System.Windows. Forms.TextBox
Friend WithEvents ContextMenu1 As System.Windows. Forms.ContextMe nu
Friend WithEvents MenuItem1 As System.Windows. Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows. Forms.MenuItem
Friend WithEvents nfi As System.Windows. Forms.NotifyIco n
Friend WithEvents Button1 As System.Windows. Forms.Button
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
Me.components = New System.Componen tModel.Containe r()
Dim resources As System.Resource s.ResourceManag er = New
System.Resource s.ResourceManag er(GetType(Form 1))
Me.Label1 = New System.Windows. Forms.Label()
Me.txt_watchpat h = New System.Windows. Forms.TextBox()
Me.btn_startwat ch = New System.Windows. Forms.Button()
Me.btn_stop = New System.Windows. Forms.Button()
Me.Label2 = New System.Windows. Forms.Label()
Me.txt_folderac tivity = New System.Windows. Forms.TextBox()
Me.ContextMenu1 = New System.Windows. Forms.ContextMe nu()
Me.MenuItem2 = New System.Windows. Forms.MenuItem( )
Me.MenuItem1 = New System.Windows. Forms.MenuItem( )
Me.nfi = New System.Windows. Forms.NotifyIco n(Me.components )
Me.Button1 = New System.Windows. Forms.Button()
Me.SuspendLayou t()
'
'Label1
'
Me.Label1.Locat ion = New System.Drawing. Point(16, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing. Size(120, 16)
Me.Label1.TabIn dex = 0
Me.Label1.Text = "Type Folder to Watch:"
'
'txt_watchpath
'
Me.txt_watchpat h.Enabled = False
Me.txt_watchpat h.Location = New System.Drawing. Point(136, 32)
Me.txt_watchpat h.Name = "txt_watchp ath"
Me.txt_watchpat h.Size = New System.Drawing. Size(216, 20)
Me.txt_watchpat h.TabIndex = 1
Me.txt_watchpat h.Text = "TextBox1"
'
'btn_startwatch
'
Me.btn_startwat ch.FlatStyle =
System.Windows. Forms.FlatStyle .Flat
Me.btn_startwat ch.Location = New System.Drawing. Point(136, 64)
Me.btn_startwat ch.Name = "btn_startwatch "
Me.btn_startwat ch.Size = New System.Drawing. Size(88, 23)
Me.btn_startwat ch.TabIndex = 2
Me.btn_startwat ch.Text = "Start Watching"
'
'btn_stop
'
Me.btn_stop.Fla tStyle = System.Windows. Forms.FlatStyle .Flat
Me.btn_stop.Loc ation = New System.Drawing. Point(232, 64)
Me.btn_stop.Nam e = "btn_stop"
Me.btn_stop.Siz e = New System.Drawing. Size(88, 23)
Me.btn_stop.Tab Index = 3
Me.btn_stop.Tex t = "Stop Watching"
'
'Label2
'
Me.Label2.AutoS ize = True
Me.Label2.Locat ion = New System.Drawing. Point(16, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing. Size(79, 13)
Me.Label2.TabIn dex = 4
Me.Label2.Text = "Folder Activity:"
'
'txt_folderacti vity
'
Me.txt_folderac tivity.Location = New System.Drawing. Point(16,
104)
Me.txt_folderac tivity.Multilin e = True
Me.txt_folderac tivity.Name = "txt_folderacti vity"
Me.txt_folderac tivity.Size = New System.Drawing. Size(448, 152)
Me.txt_folderac tivity.TabIndex = 5
Me.txt_folderac tivity.Text = "TextBox2"
'
'ContextMenu1
'
Me.ContextMenu1 .MenuItems.AddR ange(New
System.Windows. Forms.MenuItem( ) {Me.MenuItem2, Me.MenuItem1})
'
'MenuItem2
'
Me.MenuItem2.In dex = 0
Me.MenuItem2.Te xt = "&Restore"
'
'MenuItem1
'
Me.MenuItem1.In dex = 1
Me.MenuItem1.Te xt = "&Exit"
'
'nfi
'
Me.nfi.ContextM enu = Me.ContextMenu1
Me.nfi.Icon = CType(resources .GetObject("nfi .Icon"),
System.Drawing. Icon)
Me.nfi.Text = "Folder Watcher"
Me.nfi.Visible = True
'
'Button1
'
Me.Button1.Flat Style = System.Windows. Forms.FlatStyle .Flat
Me.Button1.Loca tion = New System.Drawing. Point(368, 32)
Me.Button1.Name = "Button1"
Me.Button1.TabI ndex = 6
Me.Button1.Text = "Change"
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(480, 273)
Me.Controls.Add Range(New System.Windows. Forms.Control()
{Me.Button1, Me.txt_folderac tivity, Me.Label2, Me.btn_stop,
Me.btn_startwat ch, Me.txt_watchpat h, Me.Label1})
Me.Icon = CType(resources .GetObject("$th is.Icon"),
System.Drawing. Icon)
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPositio n =
System.Windows. Forms.FormStart Position.Center Screen
Me.Text = "Folder Watcher"
Me.WindowState = System.Windows. Forms.FormWindo wState.Minimize d
Me.ResumeLayout (False)

End Sub

#End Region

Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Dim objKey As RegistryKey
Dim objUserKey As RegistryKey

txt_folderactiv ity.Text = ""
txt_watchpath.T ext = "c:\"

nfi.Visible = False

objKey = Registry.LocalM achine.OpenSubK ey _
("SYSTEM\Curren tControlSet\Con trol\ComputerNa me\ComputerName " _
, False)

objUserKey = Registry.LocalM achine.OpenSubK ey _
("SYSTEM\Curren tControlSet\Con trol", False)

strComputer = Convert.ToStrin g(objKey.GetVal ue _
("ComputerName" , ""))

strUser = System.Environm ent.UserName

'Click Event copied from btn_startwatch
If txt_watchpath.E nabled = True Then
txt_watchpath.E nabled = False
End If

watchfolder = New System.IO.FileS ystemWatcher()
exeWatcher = New System.IO.FileS ystemWatcher()
batWatcher = New System.IO.FileS ystemWatcher()
scrWatcher = New System.IO.FileS ystemWatcher()

'this is the path we want to monitor
watchfolder.Pat h = txt_watchpath.T ext
exeWatcher.Path = txt_watchpath.T ext
batWatcher.Path = txt_watchpath.T ext
scrWatcher.Path = txt_watchpath.T ext

watchfolder.Inc ludeSubdirector ies = True
exeWatcher.Incl udeSubdirectori es = True
batWatcher.Incl udeSubdirectori es = True
scrWatcher.Incl udeSubdirectori es = True

watchfolder.Fil ter = "*.cmd"
exeWatcher.Filt er = "*.exe"
batWatcher.Filt er = "*.bat"
scrWatcher.Filt er = "*.scr"

'Add a list of Filters we want to specify
'make sure you use OR for each filter as we need to all of those
watchfolder.Not ifyFilter = IO.NotifyFilter s.DirectoryName
exeWatcher.Noti fyFilter = IO.NotifyFilter s.DirectoryName
batWatcher.Noti fyFilter = IO.NotifyFilter s.DirectoryName
scrWatcher.Noti fyFilter = IO.NotifyFilter s.DirectoryName

watchfolder.Not ifyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

exeWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

batWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

scrWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

watchfolder.Not ifyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

exeWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

batWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

scrWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

'add the handler to each event
AddHandler watchfolder.Cha nged, AddressOf logchange
AddHandler exeWatcher.Chan ged, AddressOf logchange
AddHandler batWatcher.Chan ged, AddressOf logchange
AddHandler scrWatcher.Chan ged, AddressOf logchange

AddHandler watchfolder.Cre ated, AddressOf logchange
AddHandler exeWatcher.Crea ted, AddressOf logchange
AddHandler batWatcher.Crea ted, AddressOf logchange
AddHandler scrWatcher.Crea ted, AddressOf logchange

AddHandler watchfolder.Del eted, AddressOf logchange
AddHandler exeWatcher.Dele ted, AddressOf logchange
AddHandler batWatcher.Dele ted, AddressOf logchange
AddHandler scrWatcher.Dele ted, AddressOf logchange

'add the rename handler as the signature is differnet
AddHandler watchfolder.Ren amed, AddressOf logrename
AddHandler exeWatcher.Rena med, AddressOf logrename
AddHandler batWatcher.Rena med, AddressOf logrename
AddHandler scrWatcher.Rena med, AddressOf logrename

'set this property to true to start watching
watchfolder.Ena bleRaisingEvent s = True
exeWatcher.Enab leRaisingEvents = True
batWatcher.Enab leRaisingEvents = True
scrWatcher.Enab leRaisingEvents = True

btn_startwatch. Enabled = False

btn_stop.Enable d = True

If Me.WindowState = FormWindowState .Minimized Then
Me.Visible = False
nfi.Visible = True
End If

End Sub

Private Sub btn_startwatch_ Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles btn_startwatch. Click

If txt_watchpath.E nabled = True Then
txt_watchpath.E nabled = False
End If

watchfolder = New System.IO.FileS ystemWatcher()
exeWatcher = New System.IO.FileS ystemWatcher()
batWatcher = New System.IO.FileS ystemWatcher()
scrWatcher = New System.IO.FileS ystemWatcher()

'this is the path we want to monitor
watchfolder.Pat h = txt_watchpath.T ext
exeWatcher.Path = txt_watchpath.T ext
batWatcher.Path = txt_watchpath.T ext
scrWatcher.Path = txt_watchpath.T ext

watchfolder.Inc ludeSubdirector ies = True
exeWatcher.Incl udeSubdirectori es = True
batWatcher.Incl udeSubdirectori es = True
scrWatcher.Incl udeSubdirectori es = True

watchfolder.Fil ter = "*.cmd"
exeWatcher.Filt er = "*.exe"
batWatcher.Filt er = "*.bat"
scrWatcher.Filt er = "*.scr"

'Add a list of Filters we want to specify
'make sure you use OR for each filter as we need to all of those
watchfolder.Not ifyFilter = IO.NotifyFilter s.DirectoryName
exeWatcher.Noti fyFilter = IO.NotifyFilter s.DirectoryName
batWatcher.Noti fyFilter = IO.NotifyFilter s.DirectoryName
scrWatcher.Noti fyFilter = IO.NotifyFilter s.DirectoryName

watchfolder.Not ifyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

exeWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

batWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

scrWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.FileName

watchfolder.Not ifyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

exeWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

batWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

scrWatcher.Noti fyFilter = watchfolder.Not ifyFilter Or _
IO.NotifyFilter s.Attributes

'add the handler to each event
AddHandler watchfolder.Cha nged, AddressOf logchange
AddHandler exeWatcher.Chan ged, AddressOf logchange
AddHandler batWatcher.Chan ged, AddressOf logchange
AddHandler scrWatcher.Chan ged, AddressOf logchange

AddHandler watchfolder.Cre ated, AddressOf logchange
AddHandler exeWatcher.Crea ted, AddressOf logchange
AddHandler batWatcher.Crea ted, AddressOf logchange
AddHandler scrWatcher.Crea ted, AddressOf logchange

AddHandler watchfolder.Del eted, AddressOf logchange
AddHandler exeWatcher.Dele ted, AddressOf logchange
AddHandler batWatcher.Dele ted, AddressOf logchange
AddHandler scrWatcher.Dele ted, AddressOf logchange

'add the rename handler as the signature is different
AddHandler watchfolder.Ren amed, AddressOf logrename
AddHandler exeWatcher.Rena med, AddressOf logrename
AddHandler batWatcher.Rena med, AddressOf logrename
AddHandler scrWatcher.Rena med, AddressOf logrename

'set this property to true to start watching
watchfolder.Ena bleRaisingEvent s = True
exeWatcher.Enab leRaisingEvents = True
batWatcher.Enab leRaisingEvents = True
scrWatcher.Enab leRaisingEvents = True

btn_startwatch. Enabled = False

btn_stop.Enable d = True

End Sub

Private Sub btn_stop_Click( ByVal sender As Object, ByVal e As
System.EventArg s) Handles btn_stop.Click

If txt_watchpath.E nabled = False Then
txt_watchpath.E nabled = True
End If
watchfolder.Ena bleRaisingEvent s = False
exeWatcher.Enab leRaisingEvents = False
batWatcher.Enab leRaisingEvents = False
scrWatcher.Enab leRaisingEvents = False

btn_startwatch. Enabled = True
btn_stop.Enable d = False

End Sub

Private Sub logchange(ByVal source As Object, ByVal e As
System.IO.FileS ystemEventArgs)

If e.ChangeType = IO.WatcherChang eTypes.Changed Then

strLogMsg &= vbCrLf & strUser & " on " & strComputer & " -
File " & e.FullPath & _
" has been modified - " & Now()

ElseIf e.ChangeType = IO.WatcherChang eTypes.Created Then

strLogMsg &= vbCrLf & strUser & " on " & strComputer & " -
File " & e.FullPath & _
" has been created - " & Now()

Else

If e.ChangeType = IO.WatcherChang eTypes.Deleted Then

strLogMsg &= vbCrLf & strUser & " on " & strComputer & "
- File " & e.FullPath & _
" has been deleted - " & Now()

End If
End If

SaveTextToFile( strLogMsg, "C:\Log.txt ")

LognEmail(strLo gMsg)

strLogMsg = ""

End Sub

Public Sub logrename(ByVal source As Object, ByVal e As
System.IO.Renam edEventArgs)

strLogMsg &= vbCrLf & strUser & " on " & strComputer & " - File
" & e.OldName & _
" has been renamed to " & e.Name & vbCrLf

LognEmail(strLo gMsg)

strLogMsg = ""

End Sub

Private Sub nfi_DoubleClick (ByVal sender As Object, ByVal e As
System.EventArg s) Handles nfi.DoubleClick

Me.Visible = True
Me.WindowState = FormWindowState .Normal
nfi.Visible = False

End Sub

Private Sub MenuItem1_Click (ByVal sender As Object, ByVal e As
System.EventArg s) Handles MenuItem1.Click

Me.Close()

End Sub

Private Sub MenuItem2_Click (ByVal sender As Object, ByVal e As
System.EventArg s) Handles MenuItem2.Click

Me.Visible = True
Me.WindowState = FormWindowState .Normal
nfi.Visible = False

End Sub

Private Sub Form1_MinimumSi zeChanged(ByVal sender As Object, ByVal e
As System.EventArg s) Handles MyBase.MinimumS izeChanged

End Sub

Private Sub Form1_Resize(By Val sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Resize

If Me.WindowState = FormWindowState .Minimized Then
Me.Visible = False
nfi.Visible = True
End If

End Sub

Private Sub nfi_Click(ByVal sender As Object, ByVal e As
System.EventArg s) Handles nfi.Click

End Sub

Function GetEmbeddedIcon (ByVal strName As String) As Icon

Return New
Icon(System.Ref lection.Assembl y.GetExecutingA ssembly.GetMani festResource
Stream(strName) )

End Function

Public Function GetFileContents (ByVal FullPath As String, _
Optional ByRef ErrInfo As String = "") As String

Dim strContents As String
Dim objReader As StreamReader
Try

objReader = New StreamReader(Fu llPath)
strContents = objReader.ReadT oEnd()
objReader.Close ()
Return strContents
Catch Ex As Exception
ErrInfo = Ex.Message
End Try
End Function

Public Function SaveTextToFile( ByVal strData As String, _
ByVal FullPath As String, _
Optional ByVal ErrInfo As String = "") As Boolean

Dim Contents As String
Dim bAns As Boolean = False
Dim objReader As StreamWriter
Try
objReader = New StreamWriter(Fu llPath, True)
objReader.Write (strData)
objReader.Close ()
bAns = True
Catch Ex As Exception
ErrInfo = Ex.Message

End Try
Return bAns
End Function

Public Function LognEmail(ByVal strMessage As String)

Dim sSource As String
Dim sLog As String
Dim sEvent As String

sSource = "FolderWatc her"
sLog = "System"
sEvent = strMessage

If Not EventLog.Source Exists(sSource) Then
EventLog.Create EventSource(sSo urce, sLog)
End If

'EventLog.Write Entry(sSource, sEvent)
EventLog.WriteE ntry(sSource, sEvent, EventLogEntryTy pe.Warning,
234)

With m
.From = strUser & "@mcglinchey.co m"
.To = "jg*******@mcgl inchey.com"
'.CC = "jr***@mcglinch ey.com"
.Subject = "FolderWatc her Notification"
.Body = sEvent
.Priority = MailPriority.Hi gh
End With

SmtpMail.SmtpSe rver = "mail.mcglinche y.com"
SmtpMail.Send(m )

strLogMsg = ""

End Function

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

txt_watchpath.E nabled = True
txt_watchpath.S electAll()

End Sub
End Class

---- End Code ----

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
10 3041

"Jeff Grantham" <jg*******@mcgl inchey.com> wrote in message

Simply too much code and no pointers to the bit that's wrong. No idea what
you've already tried. No explanation of what you think might be wrong.

Sometimes "Less is more" :-)

Richie
Nov 20 '05 #2
I would like to use the filesystemwatch er to monitor an ftp site and download a file
when it changes. I have all the code working except specifying tha path to watch.
While I have no problems watching a physical path c:\ on my machine I do not
know how to translate the ftp site's path into something acceptable to the path of the filesystemwatch er.
e.g. What does 127.0.0.1/hirsi in unc?

Is there a utility out there similar to mappath that will get me the directory name to watch?

Thanks
Nov 20 '05 #3
* "=?Utf-8?B?SGlyc2k=?=" <an*******@disc ussions.microso ft.com> scripsit:
I would like to use the filesystemwatch er to monitor an ftp site and download a file
when it changes. I have all the code working except specifying tha path to watch.
While I have no problems watching a physical path c:\ on my machine I do not
know how to translate the ftp site's path into something acceptable to the path of the filesystemwatch er.
e.g. What does 127.0.0.1/hirsi in unc?


<msdn>
Use FileSystemWatch er to watch for changes in a specified directory. You
can watch for changes in files and subdirectories of the specified
directory. The component can watch files on a local computer, a network
drive, or a remote computer.
</msdn>

Is the remote computer a Windows machine?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
Hi Herfried
The Remote computer is a windows machine. My biggest problem is
1. Given an ftp address: ftp://127.0.0.1 how do I get the pat
information to this directory? Or any directories below this say
ftp://127.0.0.1/Hirsi where I am watching for a file called abc.txt for changes
2. I want to set the path to watch on the ftp site. setting tha path on my machin
is easy. Mywatcher.path = "c:\". Now how do I set the path for the remote compute
when all I have is the ftp address and not a physical server name

Thanks

Hirs

----- Herfried K. Wagner [MVP] wrote: ----

* "=?Utf-8?B?SGlyc2k=?=" <an*******@disc ussions.microso ft.com> scripsit
I would like to use the filesystemwatch er to monitor an ftp site and download a fil
when it changes. I have all the code working except specifying tha path to watch
While I have no problems watching a physical path c:\ on my machine I do no
know how to translate the ftp site's path into something acceptable to the path of the filesystemwatch er
e.g. What does 127.0.0.1/hirsi in unc


<msdn
Use FileSystemWatch er to watch for changes in a specified directory. Yo
can watch for changes in files and subdirectories of the specifie
directory. The component can watch files on a local computer, a networ
drive, or a remote computer
</msdn

Is the remote computer a Windows machine

--
Herfried K. Wagner [MVP
<http://www.mvps.org/dotnet>
Nov 20 '05 #5
"Hirsi" <an*******@disc ussions.microso ft.com> schrieb
Hi Herfried:
The Remote computer is a windows machine. My biggest problem is:
1. Given an ftp address: ftp://127.0.0.1 how do I get the path
information to this directory? Or any directories below this say
ftp://127.0.0.1/Hirsi where I am watching for a file called abc.txt
for changes.
2. I want to set the path to watch on the ftp site. setting tha path
on my machine
is easy. Mywatcher.path = "c:\". Now how do I set the path for the
remote computer when all I have is the ftp address and not a physical
server name?

To communicate with an FTP server, the FTP protocol must be used. You must
write/download an FTP client an use it to access the server. An FTP server
can not be accessed like the local file system or by using the UNC name like
\\server\c\bla.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
Armin
Forgive me for the confusion. I should mention that I can coonect to the ftp site and download a file
My problem is I need to set a directory (path) to watch for the filesystemwatch er to monitor change
to a file. Can you advise me on how I can set the path to watch when it is on an ftp site
Let me use my local server as an example
ftp://127.0.0.
Now If I wanted to monitor a directory on the above site how do I accomplish this
dim fs as new filesystemwatch e
fs.path = ????

is this possible

Thanks

Yussuf
Nov 20 '05 #7
"Hirsi" <an*******@disc ussions.microso ft.com> schrieb
Armin:
Forgive me for the confusion. I should mention that I can coonect
to the ftp site and download a file.
My problem is I need to set a directory (path) to watch for the
filesystemwatch er to monitor changes to a file. Can you advise me on
how I can set the path to watch when it is on an ftp site. Let me use
my local server as an example: ftp://127.0.0.1
Now If I wanted to monitor a directory on the above site how do I
accomplish this: dim fs as new filesystemwatch er
fs.path = ?????
is this possible?


No. You need an FTP client to access an FTP server. Whenever you use
"ftp://127.0.0.1" you are using an FTP client, for example IE, to connect to
the server and communicate with it using the FTP protocol.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #8
So does that mean I cannot use FileSystemWatch er on an ftp site since I cannot set
the path to watch

Thank

Hirsi
Nov 20 '05 #9
"Hirsi" <an*******@disc ussions.microso ft.com> schrieb
So does that mean I cannot use FileSystemWatch er on an ftp site since
I cannot set the path to watch?


I thought the "No" in my previous post is clear enough. ;-)

No, you can not use the FileSystemWatch er to do this.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #10

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

Similar topics

1
3674
by: jjesso | last post by:
I am trying to add a new logging level. logging.config.fileConfig("bengineLog.cfg") logging.CLIENT = logging.INFO + 1 logging.addLevelName( logging.CLIENT, 'CLIENT' ) logging.root.setLevel( ) logger = logging.getLogger(None) logging.Logger.client('test') I get error:
0
395
by: Karuppasamy | last post by:
H I am trying to use the Logging Module provided by Microsoft Application Blocks for .Net I installed everything as per the Instructions given in the 'Development Using the Logging Block' But when i am trying to run the sample, i am getting the following error in the Event Viwer Kindly help me on this
6
7325
by: pmatos | last post by:
Hi all, I am trying to create a simple but efficient C++ logging class. I know there are lots of them out there but I want something simple and efficient. The number one requirement is the possibility of shutting logging down at compile time and suffer no performance penalty whatsoever for getting logging on whenever I wish. Of course that I would need to recompile the project each time I want to turn logging on or off. But given a...
23
2228
by: Rotem | last post by:
Hi, while working on something in my current project I have made several improvements to the logging package in Python, two of them are worth mentioning: 1. addition of a logging record field %(function)s, which results in the name of the entity which logged the record. My version even deduces the class name in the case which the logger is a bound method, and assuming the name of the "self" variable is indeed "self".
6
10328
by: Burkhard Schultheis | last post by:
As I wrote last week, we have a problem with a DB2 V8 on Linux. Here is what is in db2diag.log during online backup: Starting a full database backup. 2004-04-01-02.33.54.760164 Instance:lzgneu Node:000 PID:1293(db2loggw (TELEMATX)) TID:1024 Appid:none data protection sqlpgwlp Probe:909 TailPage 0 does not match pagelsn 0023CEBF0FFB and firstlsn 0023CEBF8000
0
1871
by: robert | last post by:
As more and more python packages are starting to use the bloomy (Java-ish) 'logging' module in a mood of responsibility and as I am not overly happy with the current "thickener" style of usage, I want to put this comment and a alternative most simple default framework for discussion. Maybe there are more Python users which like to see that imported (managed) logging issue more down-to-earth and flexible ? ... Vinay Sajip wrote: >...
0
2120
by: rajesh.hanchate | last post by:
Please help me in resolving this issue. I am using EnterpriseLibrary 2.0 Exception and logging block for logging exceptions to event log. It works fine for sometime. After some time it stops logging to event log. To make it active again I need to open the web.config and save without making any changes. It starts to work again. Here is the configuration I am using. <exceptionHandling>
3
11567
by: Chris Shenton | last post by:
I am setting up handlers to log DEBUG and above to a rotating file and ERROR and above to console. But if any of my code calls a logger (e.g., logging.error("foo")) before I setup my handlers, the logging system will create a default logger that *also* emits logs, which I can't seem to get rid of. Is there a way I can suppress the creation of this default logger, or remove it when I 'm setting up my handlers? Thanks. Sample code:
3
6428
by: Lowell Alleman | last post by:
Here is the situation: I wrote my own log handler class (derived from logging.Handler) and I want to be able to use it from a logging config file, that is, a config file loaded with the logging.config.fileConfig() function. Let say my logging class is called "MyLogHandler" and it's in a module called "mylogmodule", I want to be able to make an entry something like this in my logging config file:
4
1628
by: samwyse | last post by:
In the Python 2.5 Library Reference, section 14.5.3 (Logging to multiple destinations), an example is given of logging to both a file and the console. This is done by using logging.basicConfig() to configure a log file, and then calling logging.getLogger('').addHandler(console) to add the console. However, in section 14.5.4 (Sending and receiving logging events across a network), a call is made to rootLogger.addHandler(socketHandler),...
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10243
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.