Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Folder monitering

Folder monitering

Scheduled Pinned Locked Moved Visual Basic
helpdatabasesql-serversysadminsales
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jishbalan
    wrote on last edited by
    #1

    Hello friends, I have a VB application to load the txt files to SQL server. For loading the files, i want to specify the folder where the txt files are.Then it will load the files to the server. Now what the customer wants is, to load the files automatically. ie , if any new files are added to the folder,it has to be loaded to server, with out any user interphase I am planning to call my application from windows scheduled task once a day and will check the folder for any news files are added. My problem is,how to check any updates has happened to the folder. Please help me for getting the same. I dont have much experience on application programming. So please try to give code for how to check any new files are added to the folder. Jish :(

    L 1 Reply Last reply
    0
    • J jishbalan

      Hello friends, I have a VB application to load the txt files to SQL server. For loading the files, i want to specify the folder where the txt files are.Then it will load the files to the server. Now what the customer wants is, to load the files automatically. ie , if any new files are added to the folder,it has to be loaded to server, with out any user interphase I am planning to call my application from windows scheduled task once a day and will check the folder for any news files are added. My problem is,how to check any updates has happened to the folder. Please help me for getting the same. I dont have much experience on application programming. So please try to give code for how to check any new files are added to the folder. Jish :(

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Two options; If your program is running continuously, you can use the fileSystemWatcher-component. That will only work if your application is running all the time. The second option is to create a list of the files and their dates. Save the list to disk, and compare it to the directory-structure when your application starts. That way your application won't be required to run continuously.

      J U 2 Replies Last reply
      0
      • L Lost User

        Two options; If your program is running continuously, you can use the fileSystemWatcher-component. That will only work if your application is running all the time. The second option is to create a list of the files and their dates. Save the list to disk, and compare it to the directory-structure when your application starts. That way your application won't be required to run continuously.

        J Offline
        J Offline
        jishbalan
        wrote on last edited by
        #3

        Thanks for giving the Solution!!! :) hope second one is more suitable,Because i am planning call the application using the schedular. But how to comapare the list on disk withthe directory-structure using VB. Can you please give any sample code to do so. regards Jishith :)

        S L 2 Replies Last reply
        0
        • J jishbalan

          Thanks for giving the Solution!!! :) hope second one is more suitable,Because i am planning call the application using the schedular. But how to comapare the list on disk withthe directory-structure using VB. Can you please give any sample code to do so. regards Jishith :)

          S Offline
          S Offline
          Steven J Jowett
          wrote on last edited by
          #4

          When you have imported the text file, you could rename the file by changing the extension or even deleting the file, assuming the original file is no longer required. You program then only needs to look for txt files in the designated folder.

          Steve Jowett ------------------------- Real programmers don't comment their code. If it was hard to write, it should be hard to read.

          1 Reply Last reply
          0
          • J jishbalan

            Thanks for giving the Solution!!! :) hope second one is more suitable,Because i am planning call the application using the schedular. But how to comapare the list on disk withthe directory-structure using VB. Can you please give any sample code to do so. regards Jishith :)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            I gave options, not solutions - you still got a lot of work to do :) Let's take it one step at a time; - You'll have to write a method to 'save' the contents of the folder first. Once you got that working, you can try to compare them with the current values. - Before writing a method to 'save' the contents, you'll have to have code that gives you the current contents of a folder. Do you need to watch a directory, or do you also need to watch the subdirectories?

            1 Reply Last reply
            0
            • L Lost User

              Two options; If your program is running continuously, you can use the fileSystemWatcher-component. That will only work if your application is running all the time. The second option is to create a list of the files and their dates. Save the list to disk, and compare it to the directory-structure when your application starts. That way your application won't be required to run continuously.

              U Offline
              U Offline
              Uros Calakovic
              wrote on last edited by
              #6

              eddyvluggen wrote:

              create a list of the files and their dates. Save the list to disk, and compare it to the directory-structure when your application starts

              Or use WMI permanent event subscription[^]

              In January you said "Money in April" - That was two years ago! B. Python

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups