title: Using ForEach with Get-ChildItem -recurse
body: <p>I am trying to get a recursive list of files in a particular subfolder structure, then save them to a table so that I can use a foreach loop to work with each row.  I have the following code:</p>
  
  <pre><code>$table = get-childitem -recurse | where {! $_.PSIsContainer} | Format-Table Name, Length
  
  foreach ($row in $table)
  {
    $row[0]
    $row[1]
  }
  </code></pre>
  
  <p>If I try to output <code>$table</code> as-is, it looks perfect, with two columns of data for all of the files.  If I try and step through with foreach (like above), I get the <code>"Unable to index into an object of type Microsoft.PowerShell.Commands.Internal.Format.FormatEndData."</code> error message.</p>
  
  <p>What am I doing wrong?</p>