Solved

File System Watcher work on network folder?

Posted on 2004-08-05
10
676 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:azriel_99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 5

Expert Comment

by:Jag5x5
ID: 11732752
File system watcher Class will work on Any UNC path.
all you have to do is set the directory property to \\computername\sharename

HTH
Jag5x5
0
 

Author Comment

by:azriel_99
ID: 11732884
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?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11734790
Are you getting an error when trying to access the network folder?

Bob
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:azriel_99
ID: 11735094
No, no errors at all, just does not pickup any events, except rarely sometimes it will return 'Windows' for the change event.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 11735178
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
0
 

Author Comment

by:azriel_99
ID: 11736084
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

0
 
LVL 5

Expert Comment

by:Jag5x5
ID: 11746585
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,windows2003 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
0
 

Author Comment

by:azriel_99
ID: 11748922
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.InternalBufferSize = 65536
            m_obj_FSW.Path = "\\192.5.100.62\shared"
            m_obj_FSW.Filter = "*.*"
            m_obj_FSW.IncludeSubdirectories = True
            m_obj_FSW.NotifyFilter = NotifyFilters.FileName Or NotifyFilters.LastAccess Or NotifyFilters.LastWrite

            m_obj_FSW.EnableRaisingEvents = True 'switch on watching.

        Catch ex As Exception
            MessageBox.Show(ex.ToString)
        End Try
    End Sub


    Private Sub m_obj_FSW_Changed(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs) Handles m_obj_FSW.Changed

        MessageBox.Show("hello!")
        txt_Log.AppendText("Changed: " & e.Name & vbCrLf)
    End Sub

0
 
LVL 5

Expert Comment

by:Jag5x5
ID: 11750260
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
0
 
LVL 5

Accepted Solution

by:
Jag5x5 earned 500 total points
ID: 11750270
as far as the admin log on thing as long as you have read access it should work.  if you type
\\100.100.100.100\shared     in the start box (use the real IP of the machine) do you get a browse box with the files in it?  If so you should be able to raise events of off the file system.

HTH

Jag5x5
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

718 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question