Using readdir to get the content in a folder : readdir « File « Perl






Using readdir to get the content in a folder

    

opendir(DIRECTORY, '.') 
or die "Can't open current directory.";

print join (', ', readdir(DIRECTORY));

closedir DIRECTORY;

   
    
    
    
  








Related examples in the same category

1.List the files and subdirectories in a directory.
2.Read a directory entry
3.The directory listing
4.To read a directory entry (usually a file name), use the readdir function