[advanced search]
18 members in the live chat room. Join Chat!
Register Rules & FAQ NP$ Store Active Threads Mark Forums Read
Go Back   NamePros.Com > Design and Development > Programming > CODE
User Name
Password

Old 04-18-2006, 09:40 PM   · #1
SecondVersion
while ($awake){ code(); }
 
SecondVersion's Avatar
 
Name: Eric
Location: Kentucky
Trader Rating: (137)
Join Date: Mar 2005
Posts: 4,122
NP$: 267.00 (Donate)
SecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond reputeSecondVersion has a reputation beyond repute
Member of the Month
MOTM September 2005 Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Cancer Alzheimer's Protect Our Planet
Simple directory listing function

A simple function to list a given directory's files. Got bored

PHP Code:
<?php

function list_dir($dir, $ignore = array())
{
  
$handle = opendir($dir);

  if(
$handle)
  {
    while(
false !== ($file = readdir($handle)))
    {
      if(
$file != '.' && $file != '..' && !in_array($file, $ignore))
      {
        
$files[] = $file;
      }
    }
    
sort($files);
    
$list = '';

    foreach(
$files as $file)
    {
      
$list .= $file.'<br>';
    }
  }
  
closedir($handle);
  
  return
rtrim($list, '<br>');
}

/*
Takes two arguments $dir & $ignore
$dir = the directory you want to list
$ignore = an array of specific files you don't want listed

Example usage:
*/

echo list_dir("some/directory/", array("includes", "someotherfile.php"));

/*
Outputs something like:

about.php
contact.php
index.php
style.css

... you get the idea ;)
*/

?>


Please register or log-in into NamePros to hide ads
__________________
SecondVersion.com - The Personal Blog of SecondVersion
Domain Name Portfolio - Get your free copy. - Version 1.0.1 now available!!
MetaCreator.com - Free Meta Tag Creator
SecondVersion is offline   Reply With Quote
Old 04-21-2006, 12:56 AM   · #2
cashboy
NamePros Member
 
Name: Steve
Location: NY
Trader Rating: (0)
Join Date: Apr 2006
Posts: 32
NP$: 0.00 (Donate)
cashboy is an unknown quantity at this point
can you list files from the remote server using this script? if not, is there any way to?
__________________
- Steve
cashboy is offline   Reply With Quote
Closed Thread

NamePros is a revenue sharing forum.

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


Site Sponsors
Custom Logo Design Build your NameBrand http://www.mobisitetrader.com/
Advertise your business at NamePros
All times are GMT -7. The time now is 11:39 PM.


Powered by: vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0