|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hi all
I've got a list of strings, by opendir and i wanna check which of them are also directories, is there any functions in Perl can check this? I've tried these two methods, but it doesn't work...... print "$file is a directoryn" if -d $file; @dir = grep -d, @files; a million thanksssssssss jan |
|
#2
|
|||
|
|||
|
>>if -d $file;
Make sure $file has a full server path. |
|
#3
|
|||
|
|||
|
i.e. $file is a variable like
"/public_html/home/myname/abc.txt/" ?? |
|
#4
|
|||
|
|||
|
Actually $file itself doesn't has to be full-server path, but you do need full server path for the -d, the directory test.
You can try something like this: $mydir = "/home/myname/public_html"; Then test it -d $mydir/$file; |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Perl Directory Function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|