Question: How do I grab the specific filename for a file based on my current read in method,

I am grabbing the files in this manner:

```
    var lines = Directory.GetFiles(path, "prefix*.csv").Select(
        fn => File.ReadAllLines(fn).Select(a => a.Split(',')).ToList()).ToList();

```

after each file is done I want to do a move of the file from one location to another but I do not have the exact filename:

```
     File.Move(path, destPath);

```

Answer: 
Don't abuse LINQ. If you need intermediate pieces of data (like the filename) then break pieces out of your chained LINQ statement to do what you're trying to do.

```
foreach (var filename in Directory.GetFiles(path, "prefix*.csv)) {
    var linesFromOneFile = File.ReadAllLines(filename)
                               .Select(a => a.Split(',')).ToList();

    // Whatever else with 'filename'
    File.Move(...);
}

```
In that case I believe it would be wiser to split your operation into multiple steps instead of one chained command. Store your filenames, process it however you need to and then iterate through the collection of filenames and simply move them where you want.