My task is how to compare inside the folder invoice number and Excel invoice number.
What ever the invoice number is there in excel same invoice number should be there inside the folder.
How to compare excel invoice number and folder invoice number.
If any invoice number is missing in folder we should send email and stop the process.
We can do the comparision one by one or can get all together…
If one by one
For each row in datatable…
Then use directory.Getfiles("folderpath,currentrow("invnumber").ToString + "*").count>0 to check if atleast one file is there with the given invoice number
Second aapproach
Directory.Getfiles("folderpath").Select(function(x) path.getfilenamewithoutextension(x)).ToArray this will give all the found filenames alone in an array say arr1
Dt.AsEnumerable.select(function(x) x("invnumber").ToString).ToArray this will give all the invoice numbers in excel as array say arr2
Now arr2.Except(arr1) will give the values that are not present in aar1 but present in aar2 if any