folder updated time
-
Hello friends, I am using VB Appliction(let it be X) to load the txt files to SQL server. The application is taking the files from a shared folder. Some other tool(Y) is creating these txt files and placing them in the shared folder. By chance, a situation happend if both application is running simultaneously. Then my application may getting a chance of loading half created files(creating by Y) to the server. I dont want to load such files.Want to load it to the server by next time,by that time the files will be fully generated by y. What i want is want to check last folder update time. If the folder is recently updated(means some files recently added) then dont want to run my application. So please help me to get the last folder update time. So i can compare it with system time and can decide, whether i want to run my application Thanks and regards Jishtih
-
Hello friends, I am using VB Appliction(let it be X) to load the txt files to SQL server. The application is taking the files from a shared folder. Some other tool(Y) is creating these txt files and placing them in the shared folder. By chance, a situation happend if both application is running simultaneously. Then my application may getting a chance of loading half created files(creating by Y) to the server. I dont want to load such files.Want to load it to the server by next time,by that time the files will be fully generated by y. What i want is want to check last folder update time. If the folder is recently updated(means some files recently added) then dont want to run my application. So please help me to get the last folder update time. So i can compare it with system time and can decide, whether i want to run my application Thanks and regards Jishtih
What you're asking isn't really reliable. The folder will not change it's Last Modified Time upon a write of a file inside it. It will only do this upon the creation or delete of a file. You should be inventorying the files in that folder, checking the time the files was created, then giving an appropriate amount of time for the other process to complete before opening those files and processing them.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008 -
Hello friends, I am using VB Appliction(let it be X) to load the txt files to SQL server. The application is taking the files from a shared folder. Some other tool(Y) is creating these txt files and placing them in the shared folder. By chance, a situation happend if both application is running simultaneously. Then my application may getting a chance of loading half created files(creating by Y) to the server. I dont want to load such files.Want to load it to the server by next time,by that time the files will be fully generated by y. What i want is want to check last folder update time. If the folder is recently updated(means some files recently added) then dont want to run my application. So please help me to get the last folder update time. So i can compare it with system time and can decide, whether i want to run my application Thanks and regards Jishtih
Hi, If you are going to write any code that manipulates files or folders then you need to become familiar with the classes in the System.IO namespace. There aren't many and it won't take you long to browse through the documentation and get an idea of what they do. In answer to your specific question about folder update time take at look at either System.IO.Directory or System.IO.DirectoryInfo and you will find the answer. Alan.