Folder monitering
-
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 :(
-
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 :(
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.
-
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.
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 :)
-
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 :)
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.
-
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 :)
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?
-
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.
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