Hello John, Thank you for responding. That's what I like most about this list. Ask a question, you usually end up getting a "buffet of answers" when all you could reasonably hope for was a "light snack". :)
I appreciate your time & will keep your response for future reference as well. Hungry for knowledge, K.L. Hayes Wednesday, January 09, 2002, 8:17:23 PM, you wrote: JWK> "K.L. Hayes" wrote: >> >> Hello All, JWK> Hello, >> I've found lot's of info on how to check if a file exists but nothing >> about checking if a directory exists. I've posted the relevant code >> below along with 3 variations of how I "think" it might work. If >> somebody could point to the one that is "correct" or knows of a better >> way I'd appreciate the help. Thank you. JWK> No reason to "think" about it. Read the perlfunc documentation and JWK> write a small program to test it. JWK> $ perl -le' JWK> if (-f $ARGV[0]) {print "file"} else {print "NOT a file"} JWK> if (-d _) {print "directory"} else {print "NOT a directory"} JWK> if (-r _) {print "readable"} else {print "NOT readable"} JWK> if (-w _) {print "writable"} else {print "NOT writable"} JWK> if (-x _) {print "executable"} else {print "NOT executable"} JWK> if (-e _) {print "exists"} else {print "NOT exists"} JWK> if (-s _) {print "size"} else {print "NO size"} JWK> ' test.txt JWK> file JWK> NOT a directory JWK> readable JWK> writable JWK> NOT executable JWK> exists JWK> size JWK> $ perl -le' JWK> if (-f $ARGV[0]) {print "file"} else {print "NOT a file"} JWK> if (-d _) {print "directory"} else {print "NOT a directory"} JWK> if (-r _) {print "readable"} else {print "NOT readable"} JWK> if (-w _) {print "writable"} else {print "NOT writable"} JWK> if (-x _) {print "executable"} else {print "NOT executable"} JWK> if (-e _) {print "exists"} else {print "NOT exists"} JWK> if (-s _) {print "size"} else {print "NO size"} JWK> ' bin JWK> NOT a file JWK> directory JWK> readable JWK> writable JWK> executable JWK> exists JWK> size JWK> perldoc -f -X >> use constant USER_PATH => '/home/~client/htdocs/clients/'; >> $path = USER_PATH . $personal_key; >> >> ## Is This Correct? ## >> if (-e "$path") { >> &get_on_with_it } >> else { &errorMsg } >> >> ## Or This? ## >> opendir(CLIENT, "$path") or die " &errorMsg "; >> closedir(CLIENT); >> &get_on_with_it >> >> ## Or Is It This? ## >> if (-d $path) { >> &get_on_with_it } >> else { &errorMsg } JWK> The Perl motto is "There Is More Than One Way To Do It" :-) JWK> John -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]