<?xml version="1.0" encoding="windows-1252"?>
<node id="36810" title="Answer: How do I test whether a file has some contents or not?" created="2000-10-15 13:13:37" updated="2005-07-19 22:12:50">
<type id="1888">
categorized answer</type>
<author id="11732">
QandAEditors</author>
<data>
<field name="doctext">
Filetest operators can be found at [id://370].  &amp;nbsp; Just a day or so ago [swiftone] showed me the "_" shortcut for performing multiple tests on one file. &amp;nbsp; Yet another way to look at it.

&lt;code&gt;
if (-s $file &amp;&amp; -T _) {
    # do stuff with text file &gt; 0bytes
    }
if (-s $file &amp;&amp; -B _) {
    # do stuff with binary file &gt; 0bytes
    }
&lt;/code&gt;</field>
<field name="parent_node">
36796</field>
</data>
</node>
