Jump to content

[SOLVED] Print all files in a directory.


DJTim666

Recommended Posts

The most basic of what you mean:

 

<?php
//Open the directory
$dir = dir("dir_name");

//List files in the directory
while (($file = $dir -> read()) !== false)
{
echo "Filename: " . $file . "<br />";
}

$dir -> close();
?> 

 

 

Output will be:

 

filename: .
filename: ..
filename: google.gif
filename: pulse.exe
filename: example.pdf
filename: images.zip

 

Etc..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.