Use the functions opendir, readdir, and closedir : opendir « File « Perl






Use the functions opendir, readdir, and closedir

    

    #!/usr/local/bin/perl -w

    opendir (DIRHANDLE, ".");

    @filelist = readdir (DIRHANDLE);

    closedir (DIRHANDLE);

    foreach $file (@filelist)
    {
       print "File: $file\n";
    }

   
    
    
    
  








Related examples in the same category

1.To open a directory, use the opendir command:
2.Get folder size, attributes and name
3.List the content of current folder