Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Loop through a folder and all subfolders in Powershell

$
0
0

Hey Scripting Guys,

I found this Powershell command online:

ls -r  *.txt  | % {(gc $_ | % { $_.TrimEnd() }) | sc $_ }

to remove trailing spaces from the end of each line of each text file in a folder.  How can I make it loop through the folder and all of its subfolders?

Thanks.


Viewing all articles
Browse latest Browse all 15028

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>