To open a directory, use the opendir command: : opendir « File « Perl






To open a directory, use the opendir command:

    
$status = opendir(dirhandle, $name);

#!/usr/bin/perl -w

$name = "c:\\";

opendir(DIR, $name) or die "Can't open $name due to $!";

$entry = readdir(DIR);

while ( defined($entry) ) {
    print "$entry\n";
    $entry = readdir(DIR);
}
closedir(DIR);

   
    
    
    
  








Related examples in the same category

1.Get folder size, attributes and name
2.List the content of current folder
3.Use the functions opendir, readdir, and closedir