*nix systems have an "od" utility that can display the contents of any file. By default, it does an octal dump, but -c will display the text, and -x will display hex. You can get a similar utility for Windows command lines from CygWin, or from the KMR Consulting web site.

Using such a utility will help you understand exactly what is inside a file. Once you understand the content, you can properly adjust the logic in your script.

Further, you'll find that an empty file with a "blank line" is actually two bytes - a carriage return and a line feed. If you don't trap the return from RedirectOutput, you'll get 3 bytes - the "0", a CR, and an LF.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D