I created an app that reads two columns from excel file and search for each file in column A. if file is found then it is renamed to what column b says and moved to a separate folder.
This part of the code that i am having issue, please help!!!
DirectoryInfo di = new DirectoryInfo(sourceFile);
FileInfo[] files = di.GetFiles(oldName, SearchOption.AllDirectories);
foreach (FileInfo file in files)
{
file.MoveTo(destinationFile + @"\\" + newName);
}
In debugging mode:
this is what i see in each variable
sourceFile = "c:\test"
oldName = "128-421.jpg"
newName = "128.jpg"
di = "C:\\test"
files = {System.IO.FileInfo[0]}
file = Null
Why do i keep getting Null in variable file.