473,385 Members | 1,742 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,385 software developers and data experts.

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.Diagnostics
Imports Microsoft.Win32
Imports System.Web.Mail
Public Class Form1
Inherits System.Windows.Forms.Form

Public watchfolder As FileSystemWatcher
Public exeWatcher As FileSystemWatcher
Public batWatcher As FileSystemWatcher
Public scrWatcher As FileSystemWatcher
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.
InitializeComponent()

'Add any initialization after the InitializeComponent() 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.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'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_folderactivity As System.Windows.Forms.TextBox
Friend WithEvents ContextMenu1 As System.Windows.Forms.ContextMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents nfi As System.Windows.Forms.NotifyIcon
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New
System.Resources.ResourceManager(GetType(Form1))
Me.Label1 = New System.Windows.Forms.Label()
Me.txt_watchpath = New System.Windows.Forms.TextBox()
Me.btn_startwatch = New System.Windows.Forms.Button()
Me.btn_stop = New System.Windows.Forms.Button()
Me.Label2 = New System.Windows.Forms.Label()
Me.txt_folderactivity = New System.Windows.Forms.TextBox()
Me.ContextMenu1 = New System.Windows.Forms.ContextMenu()
Me.MenuItem2 = New System.Windows.Forms.MenuItem()
Me.MenuItem1 = New System.Windows.Forms.MenuItem()
Me.nfi = New System.Windows.Forms.NotifyIcon(Me.components)
Me.Button1 = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(120, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Type Folder to Watch:"
'
'txt_watchpath
'
Me.txt_watchpath.Enabled = False
Me.txt_watchpath.Location = New System.Drawing.Point(136, 32)
Me.txt_watchpath.Name = "txt_watchpath"
Me.txt_watchpath.Size = New System.Drawing.Size(216, 20)
Me.txt_watchpath.TabIndex = 1
Me.txt_watchpath.Text = "TextBox1"
'
'btn_startwatch
'
Me.btn_startwatch.FlatStyle =
System.Windows.Forms.FlatStyle.Flat
Me.btn_startwatch.Location = New System.Drawing.Point(136, 64)
Me.btn_startwatch.Name = "btn_startwatch"
Me.btn_startwatch.Size = New System.Drawing.Size(88, 23)
Me.btn_startwatch.TabIndex = 2
Me.btn_startwatch.Text = "Start Watching"
'
'btn_stop
'
Me.btn_stop.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.btn_stop.Location = New System.Drawing.Point(232, 64)
Me.btn_stop.Name = "btn_stop"
Me.btn_stop.Size = New System.Drawing.Size(88, 23)
Me.btn_stop.TabIndex = 3
Me.btn_stop.Text = "Stop Watching"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(16, 80)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(79, 13)
Me.Label2.TabIndex = 4
Me.Label2.Text = "Folder Activity:"
'
'txt_folderactivity
'
Me.txt_folderactivity.Location = New System.Drawing.Point(16,
104)
Me.txt_folderactivity.Multiline = True
Me.txt_folderactivity.Name = "txt_folderactivity"
Me.txt_folderactivity.Size = New System.Drawing.Size(448, 152)
Me.txt_folderactivity.TabIndex = 5
Me.txt_folderactivity.Text = "TextBox2"
'
'ContextMenu1
'
Me.ContextMenu1.MenuItems.AddRange(New
System.Windows.Forms.MenuItem() {Me.MenuItem2, Me.MenuItem1})
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.Text = "&Restore"
'
'MenuItem1
'
Me.MenuItem1.Index = 1
Me.MenuItem1.Text = "&Exit"
'
'nfi
'
Me.nfi.ContextMenu = 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.FlatStyle = System.Windows.Forms.FlatStyle.Flat
Me.Button1.Location = New System.Drawing.Point(368, 32)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 6
Me.Button1.Text = "Change"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(480, 273)
Me.Controls.AddRange(New System.Windows.Forms.Control()
{Me.Button1, Me.txt_folderactivity, Me.Label2, Me.btn_stop,
Me.btn_startwatch, Me.txt_watchpath, Me.Label1})
Me.Icon = CType(resources.GetObject("$this.Icon"),
System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "Form1"
Me.StartPosition =
System.Windows.Forms.FormStartPosition.CenterScree n
Me.Text = "Folder Watcher"
Me.WindowState = System.Windows.Forms.FormWindowState.Minimized
Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim objKey As RegistryKey
Dim objUserKey As RegistryKey

txt_folderactivity.Text = ""
txt_watchpath.Text = "c:\"

nfi.Visible = False

objKey = Registry.LocalMachine.OpenSubKey _
("SYSTEM\CurrentControlSet\Control\ComputerName\Co mputerName" _
, False)

objUserKey = Registry.LocalMachine.OpenSubKey _
("SYSTEM\CurrentControlSet\Control", False)

strComputer = Convert.ToString(objKey.GetValue _
("ComputerName", ""))

strUser = System.Environment.UserName

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

watchfolder = New System.IO.FileSystemWatcher()
exeWatcher = New System.IO.FileSystemWatcher()
batWatcher = New System.IO.FileSystemWatcher()
scrWatcher = New System.IO.FileSystemWatcher()

'this is the path we want to monitor
watchfolder.Path = txt_watchpath.Text
exeWatcher.Path = txt_watchpath.Text
batWatcher.Path = txt_watchpath.Text
scrWatcher.Path = txt_watchpath.Text

watchfolder.IncludeSubdirectories = True
exeWatcher.IncludeSubdirectories = True
batWatcher.IncludeSubdirectories = True
scrWatcher.IncludeSubdirectories = True

watchfolder.Filter = "*.cmd"
exeWatcher.Filter = "*.exe"
batWatcher.Filter = "*.bat"
scrWatcher.Filter = "*.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.NotifyFilter = IO.NotifyFilters.DirectoryName
exeWatcher.NotifyFilter = IO.NotifyFilters.DirectoryName
batWatcher.NotifyFilter = IO.NotifyFilters.DirectoryName
scrWatcher.NotifyFilter = IO.NotifyFilters.DirectoryName

watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

exeWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

batWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

scrWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

exeWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

batWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

scrWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

'add the handler to each event
AddHandler watchfolder.Changed, AddressOf logchange
AddHandler exeWatcher.Changed, AddressOf logchange
AddHandler batWatcher.Changed, AddressOf logchange
AddHandler scrWatcher.Changed, AddressOf logchange

AddHandler watchfolder.Created, AddressOf logchange
AddHandler exeWatcher.Created, AddressOf logchange
AddHandler batWatcher.Created, AddressOf logchange
AddHandler scrWatcher.Created, AddressOf logchange

AddHandler watchfolder.Deleted, AddressOf logchange
AddHandler exeWatcher.Deleted, AddressOf logchange
AddHandler batWatcher.Deleted, AddressOf logchange
AddHandler scrWatcher.Deleted, AddressOf logchange

'add the rename handler as the signature is differnet
AddHandler watchfolder.Renamed, AddressOf logrename
AddHandler exeWatcher.Renamed, AddressOf logrename
AddHandler batWatcher.Renamed, AddressOf logrename
AddHandler scrWatcher.Renamed, AddressOf logrename

'set this property to true to start watching
watchfolder.EnableRaisingEvents = True
exeWatcher.EnableRaisingEvents = True
batWatcher.EnableRaisingEvents = True
scrWatcher.EnableRaisingEvents = True

btn_startwatch.Enabled = False

btn_stop.Enabled = 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.EventArgs) Handles btn_startwatch.Click

If txt_watchpath.Enabled = True Then
txt_watchpath.Enabled = False
End If

watchfolder = New System.IO.FileSystemWatcher()
exeWatcher = New System.IO.FileSystemWatcher()
batWatcher = New System.IO.FileSystemWatcher()
scrWatcher = New System.IO.FileSystemWatcher()

'this is the path we want to monitor
watchfolder.Path = txt_watchpath.Text
exeWatcher.Path = txt_watchpath.Text
batWatcher.Path = txt_watchpath.Text
scrWatcher.Path = txt_watchpath.Text

watchfolder.IncludeSubdirectories = True
exeWatcher.IncludeSubdirectories = True
batWatcher.IncludeSubdirectories = True
scrWatcher.IncludeSubdirectories = True

watchfolder.Filter = "*.cmd"
exeWatcher.Filter = "*.exe"
batWatcher.Filter = "*.bat"
scrWatcher.Filter = "*.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.NotifyFilter = IO.NotifyFilters.DirectoryName
exeWatcher.NotifyFilter = IO.NotifyFilters.DirectoryName
batWatcher.NotifyFilter = IO.NotifyFilters.DirectoryName
scrWatcher.NotifyFilter = IO.NotifyFilters.DirectoryName

watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

exeWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

batWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

scrWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.FileName

watchfolder.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

exeWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

batWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

scrWatcher.NotifyFilter = watchfolder.NotifyFilter Or _
IO.NotifyFilters.Attributes

'add the handler to each event
AddHandler watchfolder.Changed, AddressOf logchange
AddHandler exeWatcher.Changed, AddressOf logchange
AddHandler batWatcher.Changed, AddressOf logchange
AddHandler scrWatcher.Changed, AddressOf logchange

AddHandler watchfolder.Created, AddressOf logchange
AddHandler exeWatcher.Created, AddressOf logchange
AddHandler batWatcher.Created, AddressOf logchange
AddHandler scrWatcher.Created, AddressOf logchange

AddHandler watchfolder.Deleted, AddressOf logchange
AddHandler exeWatcher.Deleted, AddressOf logchange
AddHandler batWatcher.Deleted, AddressOf logchange
AddHandler scrWatcher.Deleted, AddressOf logchange

'add the rename handler as the signature is different
AddHandler watchfolder.Renamed, AddressOf logrename
AddHandler exeWatcher.Renamed, AddressOf logrename
AddHandler batWatcher.Renamed, AddressOf logrename
AddHandler scrWatcher.Renamed, AddressOf logrename

'set this property to true to start watching
watchfolder.EnableRaisingEvents = True
exeWatcher.EnableRaisingEvents = True
batWatcher.EnableRaisingEvents = True
scrWatcher.EnableRaisingEvents = True

btn_startwatch.Enabled = False

btn_stop.Enabled = True

End Sub

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

If txt_watchpath.Enabled = False Then
txt_watchpath.Enabled = True
End If
watchfolder.EnableRaisingEvents = False
exeWatcher.EnableRaisingEvents = False
batWatcher.EnableRaisingEvents = False
scrWatcher.EnableRaisingEvents = False

btn_startwatch.Enabled = True
btn_stop.Enabled = False

End Sub

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

If e.ChangeType = IO.WatcherChangeTypes.Changed Then

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

ElseIf e.ChangeType = IO.WatcherChangeTypes.Created Then

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

Else

If e.ChangeType = IO.WatcherChangeTypes.Deleted Then

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

End If
End If

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

LognEmail(strLogMsg)

strLogMsg = ""

End Sub

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

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

LognEmail(strLogMsg)

strLogMsg = ""

End Sub

Private Sub nfi_DoubleClick(ByVal sender As Object, ByVal e As
System.EventArgs) 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.EventArgs) Handles MenuItem1.Click

Me.Close()

End Sub

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

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

End Sub

Private Sub Form1_MinimumSizeChanged(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.MinimumSizeChanged

End Sub

Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) 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.EventArgs) Handles nfi.Click

End Sub

Function GetEmbeddedIcon(ByVal strName As String) As Icon

Return New
Icon(System.Reflection.Assembly.GetExecutingAssemb ly.GetManifestResource
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(FullPath)
strContents = objReader.ReadToEnd()
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(FullPath, 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 = "FolderWatcher"
sLog = "System"
sEvent = strMessage

If Not EventLog.SourceExists(sSource) Then
EventLog.CreateEventSource(sSource, sLog)
End If

'EventLog.WriteEntry(sSource, sEvent)
EventLog.WriteEntry(sSource, sEvent, EventLogEntryType.Warning,
234)

With m
.From = strUser & "@mcglinchey.com"
.To = "jg*******@mcglinchey.com"
'.CC = "jr***@mcglinchey.com"
.Subject = "FolderWatcher Notification"
.Body = sEvent
.Priority = MailPriority.High
End With

SmtpMail.SmtpServer = "mail.mcglinchey.com"
SmtpMail.Send(m)

strLogMsg = ""

End Function

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

txt_watchpath.Enabled = True
txt_watchpath.SelectAll()

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 2989

"Jeff Grantham" <jg*******@mcglinchey.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 filesystemwatcher 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 filesystemwatcher.
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*******@discussions.microsoft.com> scripsit:
I would like to use the filesystemwatcher 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 filesystemwatcher.
e.g. What does 127.0.0.1/hirsi in unc?


<msdn>
Use FileSystemWatcher 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*******@discussions.microsoft.com> scripsit
I would like to use the filesystemwatcher 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 filesystemwatcher
e.g. What does 127.0.0.1/hirsi in unc


<msdn
Use FileSystemWatcher 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*******@discussions.microsoft.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 filesystemwatcher 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 filesystemwatche
fs.path = ????

is this possible

Thanks

Yussuf
Nov 20 '05 #7
"Hirsi" <an*******@discussions.microsoft.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
filesystemwatcher 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 filesystemwatcher
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 FileSystemWatcher on an ftp site since I cannot set
the path to watch

Thank

Hirsi
Nov 20 '05 #9
"Hirsi" <an*******@discussions.microsoft.com> schrieb
So does that mean I cannot use FileSystemWatcher 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 FileSystemWatcher to do this.
--
Armin

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

Nov 20 '05 #10
Armin
Much thanks for all your help and patience. I have invested lots of tim
in the FileSystemWatcher and sadly must abandon it since it will not work fo
me

Hirsi
Nov 20 '05 #11

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

Similar topics

1
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( )...
0
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' ...
6
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...
23
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...
6
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 ...
0
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...
0
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...
3
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...
3
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...
4
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()...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.