hi there,
I am trying to write a relevance for if a number of lines in a text file is equal to zero.
Any help appreciated.
hi there,
I am trying to write a relevance for if a number of lines in a text file is equal to zero.
Any help appreciated.
See the general syntax/structure from here and change slightly to ask for number of lines
rather than size
:
number of lines of file "C:\itconfig\test\foo.txt"
For reference as to what properties are available for a file, please see:
thanks Aram .
one last question , how can i write a relevance if number of lines are equal to zero for that file ?
The following will return ‘True’ if the number of lines of the file = 0, or if the file doesn’t exist:
number of lines of files "C:\itconfig\test\foo.txt" = 0
If you want it to return ‘False’ if the file doesn’t exist, then you can leverage an if/then/else
condition:
if (exists file "C:\itconfig\test\foo.txt") then (number of lines of files "C:\itconfig\test\foo.txt" = 0) else FALSE
If you haven’t seen it already, I would recommend having a look at our Relevance Guide and Tutorial if you’re interested in learning more about how to read and/or write relevance statements.