Results 1 to 5 of 5

Thread: detecting changes in a directory

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    2

    detecting changes in a directory

    I have worked with PHP and other programming languages but I am new to VB. I want to write an application that is run manually every day, and each time it is run it checks for modified and newly created files in a particular folder
    what is the best way to do this?

  2. #2
    PowerPoster motil's Avatar
    Join Date
    Apr 2009
    Location
    Tel Aviv, Israel
    Posts
    2,143

    Re: detecting changes in a directory

    if you can leave your application open all the time you use the FileSystemWatcher class, if not you'll have to save all the files size that you need to check and comparing them each time your application is running.
    * Rate It If you Like it

    __________________________________________________________________________________________

    "Programming is like sex: one mistake and you’re providing support for a lifetime."

    Get last SQL insert ID

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: detecting changes in a directory

    You would have to have stored information about the previous contents of the folder in order to know what is new and what has been modified. You first need to decide what data you need to store and where you're going to store it. You would then want to look at using the Directory, File, DirectoryInfo and FileInfo classes from the System.IO namespace to get information about files in a folder.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2010
    Posts
    2

    Re: detecting changes in a directory

    thanks guys, but where do I save information about the files. in a database maybe?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: detecting changes in a directory

    Quote Originally Posted by techfish View Post
    thanks guys, but where do I save information about the files. in a database maybe?
    That's up to you. A database is certainly one option. You could also use an XML file, a CSV file, etc, etc.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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