azriel_99
asked on
File System Watcher work on network folder?
Hi, does the File System Watcher object work on a network folder (not on the local machine) ?
I can get it working fine on a local folder but not on any network. Can it work, and if so how?
Thankyou.
I can get it working fine on a local folder but not on any network. Can it work, and if so how?
Thankyou.
ASKER
hey, I seem to be able to get it to work some of the time now, I suspect folder permissions could be an issue, but what about a linux directory accessed through Samba? Does anyone know if that works?
Are you getting an error when trying to access the network folder?
Bob
Bob
ASKER
No, no errors at all, just does not pickup any events, except rarely sometimes it will return 'Windows' for the change event.
This works just fine for me. We need some important information:
(1) Operating system (Windows 2000, Windows XP, etc.)
(2) Network drive type (Novell, Windows, Linux, etc.)
(3) VS.NET version (2002 or 2003)
(4) Path to drive (UNC or mapped drive)
(5) Access rights to path
For me:
(1) Windows XP Professional SP1
(2) Windows 2000 Server
(3) VS.NET 2003
(4) Mapped drive
(5) Full access rights
Bob
(1) Operating system (Windows 2000, Windows XP, etc.)
(2) Network drive type (Novell, Windows, Linux, etc.)
(3) VS.NET version (2002 or 2003)
(4) Path to drive (UNC or mapped drive)
(5) Access rights to path
For me:
(1) Windows XP Professional SP1
(2) Windows 2000 Server
(3) VS.NET 2003
(4) Mapped drive
(5) Full access rights
Bob
ASKER
hmm yes, I think it must be the linux/samba, which is fair enuff I suppose. can't expect full windows integration from that!
(1) Windows XP Pro
(2) Linux
(3) VS.NET 2003
(4) \\100.100.100.100\shared (made up IP)
(5) not sure, I am able to login as Administrator
(1) Windows XP Pro
(2) Linux
(3) VS.NET 2003
(4) \\100.100.100.100\shared (made up IP)
(5) not sure, I am able to login as Administrator
If you can log in as administrator and It is a network share it should raise events. Can you post your raise events code and the code you are using to create the File system watcher?
(1) windowsxp
(2) windows2000,novellNetware5 .1,windows 2003 Server, Win2kServer
(3) VS.Net 03 Enterprise
(4) multiple using unc (I am currently monitoring 7 shares in one app)
(5) Enterprise Admin. (Full Access All Shares)
HTH
Jag5x5
(1) windowsxp
(2) windows2000,novellNetware5
(3) VS.Net 03 Enterprise
(4) multiple using unc (I am currently monitoring 7 shares in one app)
(5) Enterprise Admin. (Full Access All Shares)
HTH
Jag5x5
ASKER
hi, here is the code, I think it might indeed be that I am not logging in as Admin, must check that out if I can figure out how to change my login on that folder!
Private WithEvents m_obj_FSW As New FileSystemWatcher
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
'config settings of file watcher object.
m_obj_FSW.InternalBufferSi ze = 65536
m_obj_FSW.Path = "\\192.5.100.62\shared"
m_obj_FSW.Filter = "*.*"
m_obj_FSW.IncludeSubdirect ories = True
m_obj_FSW.NotifyFilter = NotifyFilters.FileName Or NotifyFilters.LastAccess Or NotifyFilters.LastWrite
m_obj_FSW.EnableRaisingEve nts = True 'switch on watching.
Catch ex As Exception
MessageBox.Show(ex.ToStrin g)
End Try
End Sub
Private Sub m_obj_FSW_Changed(ByVal sender As Object, ByVal e As System.IO.FileSystemEventA rgs) Handles m_obj_FSW.Changed
MessageBox.Show("hello!")
txt_Log.AppendText("Change d: " & e.Name & vbCrLf)
End Sub
Private WithEvents m_obj_FSW As New FileSystemWatcher
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
'config settings of file watcher object.
m_obj_FSW.InternalBufferSi
m_obj_FSW.Path = "\\192.5.100.62\shared"
m_obj_FSW.Filter = "*.*"
m_obj_FSW.IncludeSubdirect
m_obj_FSW.NotifyFilter = NotifyFilters.FileName Or NotifyFilters.LastAccess Or NotifyFilters.LastWrite
m_obj_FSW.EnableRaisingEve
Catch ex As Exception
MessageBox.Show(ex.ToStrin
End Try
End Sub
Private Sub m_obj_FSW_Changed(ByVal sender As Object, ByVal e As System.IO.FileSystemEventA
MessageBox.Show("hello!")
txt_Log.AppendText("Change
End Sub
everything in your code looks fine to me. I have a class that handles the creation and methods of the FSW. I can send you the Class if you like I found it on the net somewhere anyways. I do not seem to have any problems. I did have an issue with raising several events when a file is created and I handled that by creating an array and parsing the array to find out if the file is allready referenced and not adding if it is. I will post the code of the class up here on monday.
HTH
Jag5x5
HTH
Jag5x5
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
all you have to do is set the directory property to \\computername\sharename
HTH
Jag5x5