I have a folder in C:\Name\Folder\ and in that I have several files.
I need to display the full file path of the files in that folder.
It should display all the files in the format of C:\Name\Folder\file.txt. My code is as follows;
string[] filePaths = Directory.GetFiles(@"C:\Name\Folder\");
for (int i = 0; i < filePaths.Length; ++i) {
string path = filePaths[i];
Console.WriteLine(System.IO.Path.GetFileName(path));
}
It only prints the file name, but I also need it to print the full path of the file.
Whats wrong with simply printing
pathvariable?Btw you can iterate files via
foreachstatement: