Solved

File System Watcher work on network folder?

Posted on 2004-08-05
10
668 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now