GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   directory exists? in perl (https://gfy.com/showthread.php?t=106587)

Rip 02-10-2003 05:16 PM

directory exists? in perl
 
What is the correct way to find out if a directory exists in perl;

when readdir ->simply looking for a name without file extensions or is there another more accurate way?

thx :)

boldy 02-10-2003 05:19 PM

$dirname = '/etc';
if (-e $dirname) { print "yeah!\n"; }

Babaganoosh 02-10-2003 05:19 PM

if (-d $directory) {
blah
}

NetRodent 02-10-2003 05:24 PM

"-e $directory" will tell you if "$directory" exists but not that it is a directory. "-d $directory" will tell you that $directory exists and that it is a directory.

Rip 02-10-2003 05:28 PM

thanks guys, thats what i was looking for:)


All times are GMT -7. The time now is 12:32 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123