Jump to content
Sign in to follow this  

StringStripCR at the end of a test file

Recommended Posts


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!

Share this post

Link to post
Share on other sites

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

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

"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

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...