List Directory Contents

scott truesdell

October 23, 2012

using material from phpmaster.com

Using glob()

		Array
(
    [0] => Fotolia_39585197-600x190.jpg
    [1] => carne_asada_r0bman-style.html
    [2] => index.php
    [3] => list_dirs.php
    [4] => list_files_and_dirs.html
    [5] => password_protect.php
    [6] => sub_folder
)
Fotolia_39585197-600x190.jpg
carne_asada_r0bman-style.html
index.php
list_dirs.php
list_files_and_dirs.html
password_protect.php
sub_folder
  

Using opendir() and readdir()

		Array
(
    [0] => list_files_and_dirs.html
    [1] => .
    [2] => sub_folder
    [3] => password_protect.php
    [4] => index.php
    [5] => ..
    [6] => carne_asada_r0bman-style.html
    [7] => Fotolia_39585197-600x190.jpg
    [8] => list_dirs.php
)
list_files_and_dirs.html
.
sub_folder
password_protect.php
index.php
..
carne_asada_r0bman-style.html
Fotolia_39585197-600x190.jpg
list_dirs.php
    

Using opendir() and readdir() with filter

list_files_and_dirs.html
password_protect.php
index.php
carne_asada_r0bman-style.html
Fotolia_39585197-600x190.jpg
list_dirs.php
	

Using scandir()

  .
..
Fotolia_39585197-600x190.jpg
carne_asada_r0bman-style.html
index.php
list_dirs.php
list_files_and_dirs.html
password_protect.php
sub_folder
  

FilesystemIterator

  .
..
Fotolia_39585197-600x190.jpg
carne_asada_r0bman-style.html
index.php
list_dirs.php
list_files_and_dirs.html
password_protect.php
sub_folder
  

FilesystemIterator with RegexIterator

  .
..
Fotolia_39585197-600x190.jpg
carne_asada_r0bman-style.html
index.php
list_dirs.php
list_files_and_dirs.html
password_protect.php
sub_folder
  

RecursiveDirectoryIterator

  .
..
Fotolia_39585197-600x190.jpg
carne_asada_r0bman-style.html
index.php
list_dirs.php
list_files_and_dirs.html
password_protect.php
sub_folder
  

GlobIterator

  .
..
Fotolia_39585197-600x190.jpg
carne_asada_r0bman-style.html
index.php
list_dirs.php
list_files_and_dirs.html
password_protect.php
sub_folder
  

phpinfo

  


phpinfo()

PHP Version 5.3.29


System Linux whale6.serverhost.net 2.6.32-754.el6.x86_64 #1 SMP Tue Jun 19 21:26:04 UTC 2018 x86_64
Build Date May 25 2017 17:15:32
Configure Command './configure' '--with-mysql=mysqlnd' '--with-config-file-path=/home/admin/php-5.3.29' '--with-gd' '--with-apxs2=/usr/local/apache/bin/apxs' '--with-zlib=/usr' '--with-png-dir=/usr' '--enable-ftp' '--with-jpeg-dir=/usr' '--with-curl=/usr' '--with-openssl' '--enable-sockets' '--enable-track-vars' '--with-xmlrpc' '--with-mcrypt=/usr/local' '--with-libxml' '--with-freetype-dir=/usr' '--enable-pdo' '--with-pdo-sqlite' '--with-sqlite' '--with-pdo-mysql=mysqlnd' '--enable-mbstring=all' '--with-mysqli=mysqlnd' '--enable-soap' '--enable-zip' '--with-imap=/usr/local/php-imap' '--with-imap-ssl=/usr' '--with-xsl' '--enable-exif' '--enable-bcmath'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /home/admin/php-5.3.29
Loaded Configuration File /home/admin/php-5.3.29/php.ini
Scan this dir for additional .ini files (none)
Additional .ini files parsed (none)
PHP API 20090626
PHP Extension 20090626
Zend Extension 220090626
Zend Extension Build API220090626,NTS
PHP Extension Build API20090626,NTS
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
Zend Multibyte Support disabled
IPv6 Support enabled
Registered PHP Streams https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters zlib.*, convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk

This program makes use of the Zend Scripting Language Engine:
Zend Engine v2.3.0, Copyright (c) 1998-2014 Zend Technologies
    with the ionCube PHP Loader v4.2.2, Copyright (c) 2002-2012, by ionCube Ltd., and
    with Zend Guard Loader v3.3, Copyright (c) 1998-2010, by Zend Technologies