Reply
PHP Help, Listing files in a Directory
Old 10-05-2002, 08:43 AM PHP Help, Listing files in a Directory
Blizack's Avatar
Experienced Talker

Posts: 40
I'm working on a gallery and am trying to list all the files in a directory. My book says that to list all the directories I need to use ftp_nlist (ftp_stram, directory). Just one problem though... I have no idea what ftp_stream is. So if anyone could help that'd be great.
__________________
Webmaster of Desktopgamers.com and vgProjects.com
Blizack is offline
Reply With Quote
View Public Profile Visit Blizack's homepage!
 
When You Register, These Ads Go Away!
     
Old 10-05-2002, 10:28 PM
conkermaniac's Avatar
The Nutty Moderator

Posts: 1,012
Location: China
Hmm...I just did a search for ftp_stream on Google, and the top sites were all in different languages.

There were sites in German, French, Chinese, Russian, and English in just 10 results, but none of them seemed helpful at all.
__________________
Aimoo - Affordable feature-packed remotely hosted message boards!
conkermaniac is offline
Reply With Quote
View Public Profile Visit conkermaniac's homepage!
 
Old 10-06-2002, 12:11 AM
Blizack's Avatar
Experienced Talker

Posts: 40
Yea I had the same tihng
__________________
Webmaster of Desktopgamers.com and vgProjects.com
Blizack is offline
Reply With Quote
View Public Profile Visit Blizack's homepage!
 
Old 10-06-2002, 04:18 AM
AhmedF's Avatar
Left for Better Places

Posts: 258
Code:
<?php
$dir_name="e:\\publicnew\\sales alerts";
$url_name="https://www.colonyliquor.com/salesalerts";

$dir = opendir($dir_name);
$basename = basename($dir_name);
$fileArr = array();

while ($file_name = readdir($dir))
{
if (($file_name !=".") && ($file_name !=
".."))
{
#Get file modification date...
#
$fName = "$dir_name/$file_name";
$fTime = filemtime($fName);
$fileArr[$file_name] = $fTime;
}
}

# Use arsort to get most recent first
# and asort to get oldest first
arsort($fileArr);

$numberOfFiles = sizeOf($fileArr);
for($t=0;$t<$numberOfFiles;$t++)
{
$thisFile = each($fileArr);
$thisName = $thisFile[0];
$thisDay = $thisFile[1];
$thisTime = $thisFile[1];
$thisDay = date("m/d/Y", $thisDay);
$thisTime = date("h:i:s a", $thisTime);
echo "<font face='Geneva, Arial, Helvetica, san-serif' size='4' color='#000000'>";
echo "$thisDay    $thisTime    <a href='$url_name/$thisName'>$thisName</a></font><br>";
}
closedir ($dir);
?>
Mind you ... not my code ... so do not credit me
AhmedF is offline
Reply With Quote
View Public Profile
 
Old 10-06-2002, 11:27 AM
Blizack's Avatar
Experienced Talker

Posts: 40
Woah cool, thank you very much!
__________________
Webmaster of Desktopgamers.com and vgProjects.com
Blizack is offline
Reply With Quote
View Public Profile Visit Blizack's homepage!
 
Reply     « Reply to PHP Help, Listing files in a Directory
 

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13004 seconds with 13 queries