Jump to content

StringStripCR at the end of a test file


Recommended Posts

Greetings,

When I run this simple batch command to output just the directory structure of the root of C:\, it leaves a blank line at the end of the text file:

cmd.exe /c dir /b /ad c:\ > c:\rootdir.txt

I wanted to remove that last blank line, so the actual last line is one where there is an actual directory name entry (as in, when I click on the last line of the text file, it's on that blank line instead of the last text entry being the last line).

I did a search on the "StringStripCR", but I wasn't having any luck or wasn't understanding any of the scripts that would actually perform this task. Any help would be greatly appreciated and thanks advance!

Link to comment
Share on other sites

One quick simple way of doing this to give you some ideas.

Global $sData = FileRead("c:\rootdir.txt")
FileDelete("c:\rootdir.txt")
$sData=StringStripWS($sData, 2 )
FileWrite("c:\rootdir.txt",$sData)

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...