Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to determine whether a dir entry is a directory?

by ozone (Friar)
on Aug 22, 2001 at 18:25 UTC ( #106957=note: print w/replies, xml ) Need Help??


in reply to How to determine whether a dir entry is a directory?

you can simply use the -f and -d flags to determine if something is a file or a directory, like so:
my $fileA = "./something"; my $fileB = "./something/else.txt"; if(-d $fileA and -f $fileB) { ... }
This will check to see if $fileA refers to a directory and if $fileB refers to a file...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://106957]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2022-05-28 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (99 votes). Check out past polls.

    Notices?