Solved

File System Watcher work on network folder?

Posted on 2004-08-05
10
667 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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

21 Experts available now in Live!

Get 1:1 Help Now