-e File exists.
is there one for directory exists? because i didnt see it on http://perldoc.perl.org/functions/-X.html
Or what would be a best way to test it?
next unless (-e $dir . "/dirname"); -e only for file so doesnt work
I am trying to avoid doing opendir and grep
to find the dirname because it seems to be overkill.
updated question:
does perl concat $dir . "/dirname" before doing the -e or -d check?
Use the -d
test to see if the given path is a directory. In that case, -e
will also return true, because that tests for existence of some filesystem object.
To see if a path points to a plain file (no directory, no symlink, no special file), use -f
.
So you want:
-d "$dir/dirname" or next;