-2

Possible Duplicate:
PHP list all files in directory

ive got a cron job running creating .xls files every 24hrs, they are creating them in a directory on my site called www.mysite.com/sheets

what i want to do is make a webpage where i can go to and see all the .xls files in that directory and download the ones i was instead of having to download them using an ftp client.

Is there a name for this sort of thing ? what would i write it in ? i was thinking i could do it in php by echoing the folders contents, would that work ?

cheers

Community
  • 1
  • 1
user1037444
  • 313
  • 1
  • 6
  • 13
  • 2
    possible duplicate of [PHP list all files in directory](http://stackoverflow.com/questions/3826963/php-list-all-files-in-directory), [PHP - Code to traverse a directory and get all the files(images)](http://stackoverflow.com/questions/3608202/php-code-to-traverse-a-directory-and-get-all-the-filesimages), and many many other identical questions. – salathe Jan 28 '12 at 19:12
  • perhaps you are looking for scandir function of php.. [Read Description From php.net](http://php.net/manual/en/function.scandir.php) – Rajat Singhal Jan 28 '12 at 19:11

3 Answers3

0

Use glob() plus some filtering for xls files.

glob("*.xls")
Elzo Valugi
  • 27,240
  • 15
  • 95
  • 114
  • thanks, do you know where in this script i would put that ? '); $d = opendir($c); while($f = readdir($d)) { if(strpos($f, '.') === 0) continue; $ff = $c . '/' . $f; echo('
  • ' . $ff . '
  • '); if(is_dir($ff)) paintUndersideOfFox($ff); } echo(''); } paintUndersideOfFox('.'); ?> – user1037444 Jan 28 '12 at 19:30