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

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

Hi @Piotr_Przeklasa

Use Read Text file
Check the length.


Result var is String

Hope it helps!!

Hi @Piotr_Przeklasa

→ Store the file path in a String Variable called FilePath.
→ Create a Array[String] variable called NoofLines

Assign - NoofLines = System.IO.File.ReadAllLines(FilePath.ToString)

→ Create another int variable called Lines

Assign - Lines = NoofLines.Count

Then take a if condition to check the Lines count which is greater than 1.

If - Lines>1

Hope it helps!!

@Piotr_Przeklasa

Updated the solution Kindly check

Hope it helps!!

Hi @Piotr_Przeklasa

Try this

Output.Split(Environment.NewLine.ToCharArray).Count

I hope it helps!!