You are looking for the command scandir.
$path="/tmp";
$files = scandir($path);
Following code will remove .
and ..
from the returned array from scandir
:
$files = array_diff(scandir($path), array('.', '..'));
More Related Contents:
- PHP list of specific files in a directory
- How to [recursively] Zip a directory in PHP? [duplicate]
- How do I use filesystem functions in PHP, using UTF-8 strings?
- Getting the names of all files in a directory with PHP
- PHP Get all subdirectories of a given directory
- Listing all the folders subfolders and files in a directory using php
- PHP list all files in directory [duplicate]
- PHP – Move a file into a different folder on the server
- Count how many files in directory PHP
- Sort and display directory list alphabetically using opendir() in php
- Create a folder if it doesn’t already exist
- PHP read sub-directories and loop through files how to?
- Javascript equivalent of PHP’s list()
- Deleting all files from a folder using PHP?
- How can I use PHP to check if a directory is empty?
- php creating zips without path to files inside the zip
- How to delete a folder with contents using PHP [duplicate]
- Function list of php file
- PHP recursive directory path
- Loop code for each file in a directory [duplicate]
- ERROR 403 in loading resources like CSS and JS in my index.php
- Get parent directory of running script
- Why is it whenever I use scandir() I receive periods at the beginning of the array?
- A recursive remove directory function for PHP?
- How to obtain a nested HTML list from object’s array recordset?
- Get the hierarchy of a directory with PHP
- How to get the newest file in a directory in php
- How to check if directory contents has changed with PHP?
- PHP – Listing all directories and sub-directories recursively in drop down menu [duplicate]
- Using scandir() to find folders in a directory (PHP)