How can i process more then one file.
There are three files PC1_456454_test_544.csv, PC8_546545_test_54564.csv and PC10_sdfds_test_56464.csv
All the those three files must be processed and added in "Barcodes.txt"
There are three files PC1_456454_test_544.csv, PC8_546545_test_54564.csv and PC10_sdfds_test_56464.csv
All the those three files must be processed and added in "Barcodes.txt"
static void Main(string[] args) { string path = @"c:"; string fileName = "PC1" + "*" + "test" + "*" + ".csv"; string[] files = System.IO.Directory.GetFiles(path, fileName); string datetime = DateTime.Now.ToString("_yyMMdd"); string read =""; string barcode = ""; string barcode3s = ""; DirectoryInfo di = new DirectoryInfo(path); FileInfo[] Files = di.GetFiles(fileName); using (StreamReader reader = new StreamReader(files[0])) using (StreamWriter write = new StreamWriter(path + "Barcodes.txt", false, Encoding.GetEncoding(1250))) do { read = reader.ReadLine(); if (read != null) { if (read.Substring(0, 2) == "80") { barcode = read.Substring(5, 24); barcode3s = read.Substring(36); int lengtebarcode3s = barcode3s.Length; int lengtespace = 40 - lengtebarcode3s; string schrijvenbarcode3s = barcode3s + new string(' ', lengtespace); write.WriteLine(schrijvenbarcode3s + barcode); } } } while (read != null); }
Last edited by a moderator: