title: Get file size from text file
body: <p>Trying to get the file size from a list then output the results to a text file. At present I have been able to get the first half working of reading from a file checking if the file exists and then outputting to console and textfile</p>
  
  <p>I am new programming "Just started this week". This may be any easy question and tried but cant quite get it working</p>
  
  <p>I have tried putting this inside the foreach loop and trying to read path but it isnt working.</p>
  
  <pre><code>        DirectoryInfo di = new DirectoryInfo(path);
          FileInfo[] fiArr = di.GetFiles();
          foreach (FileInfo f in fiArr)
  </code></pre>
  
  <p>My code so far</p>
  
  <pre><code>    static void Main(string[] args)
      {
  
          string[] lines = System.IO.File.ReadAllLines(@"C:\Locations2.txt");
          foreach (string path in lines)
              if (File.Exists(path))
                  using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Results.txt", true))
                  {
                      file.WriteLine("File found" + "\t" + path);
                      Console.WriteLine("File found" + "\t" + path);
                  }
  
  
              else
                  using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Results.txt", true))
                  {
                      file.WriteLine("Does not Exist" + "\t" + path);
                      Console.WriteLine("Does not Exist" + "\t" + path);
                  }
  
      }
  </code></pre>
  
  <p>Thankyou in advance and if this in badly code can you advise why it should not be done this way?</p>