Can anyone help me how to extract file name with extension from a folder and check extracted file name in excel. if not exists then it should enter the file name in Column A and in column B update as “Pending” please refer my screen shot below.
Get file from folder in a list listFile=Directory.GetFiles("FolderPath")
for each item in listfile
if((from dr as datarow in DT where dr.item(“Column A”).ToString.Contains(path.GetFileNameWithoutExtension(item.ToString)) select dr).count>0)
{
}
else
{
Add data row ({path.GetFileNameWithoutExtension(item.ToString),“Pending”})
}
Good to know about your though!
The logic is still the same, the only difference here is parameter is interchanged & loop is avoided since it might affect performance.