-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

Felice Pollano
  • 32,832
  • 9
  • 75
  • 115
Manoj Chowdary
  • 97
  • 1
  • 3
  • 15

1 Answers1

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());
    }
    
zzfima
  • 1,528
  • 1
  • 14
  • 21
  • 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 – Manoj Chowdary Dec 31 '12 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 01 '13 at 06:25
  • please leave the counter issue it is not the problem. I was not getting the content to read – Manoj Chowdary Jan 01 '13 at 12:47