FileMode.Create?
-
Hi, I've got to import a collection of text files into a database, the collection being anywhere between 3 and 20 files in size. A typical collection would look like 1 x AD?????????.txt 1 x LB?????????.txt ? x PL?????????.txt There can be anywhere between 1 and 20 PL files at any one time. I'm wondering on what the best way is to deal with the files with multiple versions, ie the PL files. Is it better to create a new file and append all of the text from the PL files into it before import? If so, how? I know there is a FileMode.Create method but am unsure as how to use it. Any tips on this or suggestions on a better approach would be greatly welcomed. Thanks a lot Scott
-
Hi, I've got to import a collection of text files into a database, the collection being anywhere between 3 and 20 files in size. A typical collection would look like 1 x AD?????????.txt 1 x LB?????????.txt ? x PL?????????.txt There can be anywhere between 1 and 20 PL files at any one time. I'm wondering on what the best way is to deal with the files with multiple versions, ie the PL files. Is it better to create a new file and append all of the text from the PL files into it before import? If so, how? I know there is a FileMode.Create method but am unsure as how to use it. Any tips on this or suggestions on a better approach would be greatly welcomed. Thanks a lot Scott
Are you creating these files, or just importing them into the database? If it's an import, just traverse through the directory and get the files that match your file mask, and import them one at a time. It seems like a longer process to concatenate the files. In the case of an error, you will know exactly which file caused the exception when they are imported separately.