CoderZone.org

Category: >> Perl Code >> Get A Directory Listing Of Specific File Types Bookmark and Share

<< lastnext >>

Snippet Name: Get A Directory Listing Of Specific File Types

Description: The following snippet puts a list of file names from the current directory that end with either ".cgi" or ".pl" into array @d, using the grep function to do so.

Also see:
» Write or update an htpasswd file i...
» Validate file extensions in upload...
» Javascript Include - allows dynami...
» Remove empty lines from a string o...
» Automatically find location of jav...
» Remove empty lines from text files
» Delete a file in Visual Basic
» Copy a file in VB
» Reading and Writing to text files ...
» Parsing PHP in Javascript Files
» Perl version of file_get_contents&...
» Binding a ListBox Control to a Dat...
» Read the contents of an entire fil...
» Create an array from the contents ...
» Create an array from the lines of ...
» Remove Duplicate Lines from a File
» Extract Just The BODY Of An HTML F...
» Rename Files Interactively
» Sort A File List By Month Name In ...
» Get File Size Over HTTP
» Check If A Directory Allows File C...
» Copy Files By Date Modified
» Output To STDOUT Or A File
» Pre-populated List of Countries
» Include All Files In A Directory
» More File Type Detection in PHP
» Copy a remote file to your site
» Create a drop down menu from an ar...
» RMAN: List the most recent Level 0...

Comment: (none)

Author: CoderZone
Language: PERL
Highlight Mode: PERL
Last Modified: December 03rd, 2010

opendir D,'.';
my @d = grep /^.*?\.(cgi|pl)$/i,readdir D;
closedir D;
 
print join "\n<br>",@d;
 
 
There haven't been any comments added for this snippet yet. You may add one if you like.  Add a comment 
© coderzone.org | users online: 5