Results 1 to 14 of 14

Thread: File System Watcher [Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94

    File System Watcher [Resolved]

    Hey

    Ive been reading about the FileSystemWatcher class present in VB.net which can raise events when a file is deleted, updated etc from a specific folder.

    This appears much easier than the API calls needed in VB 6 however at the moment ive only seen examples that monitor one directory. Is it possible to create an application to monitor the whole hard drive for file / folder changes? At the moment performance is not an issue more if its possible.

    Cheers.

    Gav
    Last edited by gav032; Feb 7th, 2003 at 12:39 PM.

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Dim fsWatch As New FileSystemWatcher("c:\")
    fsWatch.IncludeSubdirectories = True
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94
    That it?

    Omg! thats incredible!

    Just out of interest, does that mean ill be able to monitor pretty much all file / folder activity on the system? What are the limitations of the file watcher? And can i watch for all files rather than ones with a specific file type?


    Gav

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    You can watch for anything you want. If you dont use the filer property it will look for any file type.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94
    Sorry for keep posting! I just keep thinking of questions about it. After this i can safely resolve this thread though.

    Can file watcher monitor new folders being created or folders being deleted too? I also presume it works in 98 and 2000 / XP systems too? Given thats it appears to be a standard class.

    Thanks again.

    Gav
    Last edited by gav032; Feb 7th, 2003 at 11:41 AM.

  6. #6
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    yes and yes
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94
    God i love Forums! How did we cope without them?

    Thanks for giving me all the information i needed!

    Now i can resolve this thread!

    Thanks again.

    Gav

  8. #8
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    your welcome.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  9. #9
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    Is the .net sdk avaliable for download so I could get this to work on vb6?
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  10. #10

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94
    As far as i am aware, you can only use the File Watcher Class in .NET. Thus, you could not incoporate this into VB6 since it requires the .NET Framework which .NET uses.

    As for compatibility, the File Watcher class only runs on Windows 2000 +, excluding Windows 98 Users.

    Regards

    Gav

  11. #11
    Addicted Member
    Join Date
    Aug 2002
    Location
    Australia
    Posts
    243
    If I downloaded and installed the .net SDK could I do this in vb6?
    Scott
    **********
    Visit my web page at www.hyphenex.ugtech.net

  12. #12

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94
    Not as far as i am aware, since VB6 does not run in the .NET framework. Perhaps you could make a control of sorts (is this possible in .net?) and then use this in vb6 but as far as i am aware your only option is to code that particular feature in .NET and then use VB6 for the rest of your things (Similar to what i did for a project last year.)

    Gav

  13. #13
    Junior Member
    Join Date
    Jan 2002
    Location
    New Zealand
    Posts
    31

    Filesystemwatcher

    Is it any way to find who make changes on a file through filesystemwatcher, especially network user.

  14. #14

    Thread Starter
    Lively Member
    Join Date
    May 2002
    Posts
    94
    Not that im aware of, because, im not sure Windows marks the file with the current / last edited user. However, Microsoft Office documents do contain these values, as do files held on an NTSC file system (Right click on file > Properties > Summary) , although Windows, by default, does not set this value, it is the Microsoft Office application or the user.

    Cheers

    Gav

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width