I have multiple csv files (in thousands), that contain an unwanted last row in the end. I have tried many presented ways in the previous posts by using 'SkipLast 1', which did not work for me. All i have is a folder of similar csv files that need their last row to be omitted. Can someone help this by using a loop sequence or something similar.
You have to use Get-Content on each file in a loop, remove the last line not skip it, then save, then loop to the next.
What did you search for? Removing lines from a text file is a very common thing, with lots of examples all over the web.
A quick search using your use case ...
'remove lines from a text file with powershell'... or 'remove last line from a text file with powershell'
... will show you many suggested options.
Powered by IDERA