Beispiel #1
0
        public static void VerifyFileNames()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("FileName");
            dt.Columns.Add("ExtractedID");
            dt.Columns.Add("Match");

            string dir = $@"{jobDir}\PDF Extraction\Transcripts\Fixed\New folder";

            string[] files = Directory.GetFiles(dir);
            string   id    = "";

            foreach (var file in files)
            {
                id = ReadID(file);
                DataRow r = dt.NewRow();
                r["FileName"]    = file;
                r["ExtractedID"] = id;
                r["Match"]       = System.IO.Path.GetFileNameWithoutExtension(file).Split('-')[0] == id ? "True" : "False";
                dt.Rows.Add(r);
            }

            TextFileRW.writeTableToTxtFile(dt, $@"{jobDir}\PDF Extraction\FileNameVerification.txt", "\t");
        }
Beispiel #2
0
        public static void MatchIDs()
        {
            DataTable source = TextFileRW.readTextFileToTable($@"{jobDir}\{dataFile}", "\t");

            source.Columns.Add("PageCount");
            source.Columns.Add("Index");
            DataTable sample = TextFileRW.readTextFileToTable($@"{jobDir}\PDF Extraction\PageCounts.txt", "\t");

            sample.Columns.Add("Matched");

            foreach (DataRow sourceRow in source.Rows)
            {
                foreach (DataRow sampleRow in sample.Rows)
                {
                    if (sourceRow["Person Id"].ToString() == sampleRow["ID"].ToString())
                    {
                        sourceRow["PageCount"] = sampleRow["PageCount"];
                        sourceRow["Index"]     = sampleRow["Index"];
                        sampleRow["Matched"]   = "True";
                    }
                }
            }

            TextFileRW.writeTableToTxtFile(source, $@"{jobDir}\{dataFile.Replace(".txt","")}_merged.txt", "\t");
            TextFileRW.writeTableToTxtFile(sample, $@"{jobDir}\Transcripts List.txt", "\t");
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            string fileName = @"C:\Users\Gayan\Documents\MSOL\DEBTOR_123456781234_ALL LETTER TYPES.txt";

            DataTable dt = TextFileRW.readTextFileToTable(fileName, "\t");

            foreach (DataRow row  in dt.Rows)
            {
                foreach (DataColumn col in dt.Columns)
                {
                    Console.Write($"{row[col].ToString()} ");
                }
                Console.Write("\n");
            }
            Console.Read();
        }
Beispiel #4
0
        public static void PdfRename()
        {
            string dir = $@"{jobDir}\PDF Extraction\Transcripts\";

            string[]  files = Directory.GetFiles(dir);
            DataTable dt    = TextFileRW.readTextFileToTable($@"{jobDir}\PDF Extraction\extractedIDs.txt", "\t");
            Dictionary <int, string> names = new Dictionary <int, string>();

            foreach (DataRow r in dt.Rows)
            {
                names.Add(int.Parse(r["Index"].ToString()), r["FileName"].ToString());
            }

            foreach (var file in files)
            {
                string f     = System.IO.Path.GetFileName(file);
                int    index = int.Parse(f.Replace($"{sourcePDF.Replace(".pdf","")}_Part", "").Replace(".pdf", ""));

                Directory.Move(file, $@"{dir}\{names[index]}.pdf");
            }
        }
Beispiel #5
0
        public static void MoveFiles()
        {
            string dir = $@"{jobDir}\PDF Extraction\Transcripts\";

            string[]  files = Directory.GetFiles(dir);
            DataTable dt    = TextFileRW.readTextFileToTable($@"{jobDir}\PDF Extraction\Bad Files.txt", "\t");
            Dictionary <int, string> names = new Dictionary <int, string>();


            foreach (var file in files)
            {
                string f = System.IO.Path.GetFileName(file);


                foreach (DataRow r in dt.Rows)
                {
                    if (file == r[0].ToString())
                    {
                        Directory.Move(file, $@"{dir}\bad files\{f}");
                    }
                }
            }
        }