-3
        var dir = new DirectoryInfo(Path);
        foreach (FileInfo flInfo in dir.GetFiles())
        {
            String name = flInfo.Name;
            long size = flInfo.Length;
            DateTime creationTime = flInfo.CreationTime;
            const int counter = 0;
            int count = counter + 1;
        }

I am getting the path but not not reading the content and file info

3
  • 2
    How about adding File.ReadAllText(flInfo.Name) ? msdn.microsoft.com/en-us/library/s2tte0y1.aspx
    – rene
    Dec 31, 2012 at 10:33
  • 3
    don't know how this is related with WPF Dec 31, 2012 at 10:46
  • THe usual way. "It is related to WPF ins the way that hte poster has no clue what he is doing". As such, he does not understand what WPF actually is.
    – TomTom
    Dec 31, 2012 at 18:59

1 Answer 1

0
  1. I do not understand, why you need counter variable
  2. You do not try read the content. If you want read the file, use stream to read it:

    using (StreamReader reader = flInfo.OpenText())
    {
    Console.WriteLine(reader.ReadToEnd());
    }
    
3
  • Hi zzfima i added counter to check whether file is reading or not. i want to read all the files in a directory not a single file can you modify your code and add it pplease. I was not getting the files from the directory not the file reading problem Dec 31, 2012 at 14:24
  • You do not increase "counter" variable (at least in current peace of code), pay attention. So, your problem is getting files from directory?
    – zzfima
    Jan 1, 2013 at 6:25
  • please leave the counter issue it is not the problem. I was not getting the content to read Jan 1, 2013 at 12:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.