I want to find a file that has .pdf extension and I want to find with name too. For example I have filename = "Work.pdf". I want to write a method that could find with name. Is there any builtin method for this?
string fileName = "Work.pdf"
string[] files = System.IO.Directory.GetFiles("C:\Files", "*.pdf");
// string myWorkPdfFile = files.Where() //search the files with fileName
You can try to pass fileName
value be second parameter.
string fileName = "Work.pdf";
string[] files = System.IO.Directory.GetFiles(@"C:\Files", fileName);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.