in reply to Diff between file and directory

You're probably looking for the -d and -f file test operators. There is a discussion of them in the Camel Book section 1.5.7.

print "this is a file\n" if -f; print "this is a directory\n" if -d;

You might prefer to use a module like File::Find instead. It has all of your logic built into it already.

Hope that helps.

--
Allolex

Replies are listed 'Best First'.
Re: Re: Diff between file and directory
by Grygonos (Chaplain) on Aug 25, 2003 at 19:28 UTC

    you could also try and open the directory. if it succeeds close it. I used this is a recursive function for mapping drive contents to a logfile.

    ie