Solved

File System Watcher work on network folder?

Posted on 2004-08-05
10
669 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

813 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

10 Experts available now in Live!

Get 1:1 Help Now