How to quickly check if a file has 1 or more lines of text?

Microsoft Windows
Post Reply
PiotrMP006
Posts: 13
Joined: 2021-Sep-01, 10:57 am

How to quickly check if a file has 1 or more lines of text?

Post by PiotrMP006 »

Hi

How to quickly check if a file has 1 or more lines of text?

I'm not talking about counting all lines of text, just a quick check if the file has 1 or more lines.

Please help me
User avatar
Simon Sheppard
Posts: 170
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: How to quickly check if a file has 1 or more lines of text?

Post by Simon Sheppard »

You could just measure if the file is greater than 0 bytes using DIR but I think you probably need to be more precise about what counts as a line of text.

Does it have to be ascii or unicode?
What if the file contains nothing but spaces or tab characters or vertical tabs?
Does the line need to end with a CR/LF?
What if the file contains text but no CR/LF, or a CR/LF with no text?
Does the file need to end with an EOF character?
What if the file contains binary data?
What if the file contains binary data followed by text followed by a CR/LF?
Post Reply