[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] file test operator



On Tue, Sep 21, 1999 at 11:54:24AM -0400, Noe Dinnerstein:  President, BodhiSoftWare wrote:
> Dear People,
>
> I'm a little dense and have trouble understanding the syntax of the file
> test operator.  I am writing a search engine and need to determine if a
> file is text or directory (folder) as I loop through a main directory.
> Could someone please spell out how to do this?  I didn't understand the
> explanation in MacPerl Power and Ease.  Thanks in advance.
>

if (-d 'path:to:file') {
  print "It's a directory\n";
} elsif (-T 'path:to:file') {
  print "It's a text file.\n";
} else {
  print "It's something else.\n";
}

Ronald

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org