CoderZone.org

Category: >> Perl Code >> Create an array from the contents of a directory Bookmark and Share

<< lastnext >>

Snippet Name: Create an array from the contents of a directory

Description: The function readdir returns a list of the names of each file object in the given directory (including "invisible" files) as well as other directories. Used in an array context it will place each item into an array field.

Also see:
» Write or update an htpasswd file i...
» Active Directory - Reading the Use...
» 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
» Simple directory viewer / browser
» Recursive Directory Browser
» 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&...
» Read the contents of an entire fil...
» Randomize an array
» Removing duplicate array items whi...
» Get every 2nd (or 3rd, 4th, ...) e...
» Grab the last element of an array
» Create an array from the lines of ...
» Create an array from comma separat...
» 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
» Get A Directory Listing Of Specifi...
» Check If A Directory Allows File C...
» Copy Files By Date Modified

Comment: (none)

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

opendir MYDIR, "/path/to/some/directory/";
@arr = readdir MYDIR;
 
 
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: 7