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
Solved

File System Watcher work on network folder?

Posted on 2004-08-05
10
670 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
  • 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

840 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