title: How to count rows in text files and store them in a single file?
body: <p>Hello I use this code below to count lines in each text file in a directory and then store that information in a single file. Problem is that output file store a full path to each text file:
  output example:                   </p>
  
  <pre><code>c:\Text folder\file1.txt,14                  
  c:\Text folder\file2.txt,20          
  c:\Text folder\file3.txt,25
  </code></pre>
  
  <p>I need output to be like this:</p>
  
  <pre><code>file1,14   
  file2,20   
  file3,25
  </code></pre>
  
  <p>Thank you for help. This is my code:</p>
  
  <pre><code>Clear-Host
  Get-ChildItem -re -in $include -ex $exclude $path |
  Foreach-Object { Write-Host "Counting $_.FullName"                 
  $fileStats = Get-Content $_.FullName | Measure-Object -line
  $linesInFile = $fileStats.Lines
  "$_,$linesInFile" } | Out-File $outputFile -encoding "UTF8"
  Write-Host "Complete"
  </code></pre>