You are here: Re: [PHP] directory listing from text file « PHP « IT news, forums, messages
Re: [PHP] directory listing from text file

Posted by Dreiph on 10/20/63 11:16

Thank you Chris,

but this is not I needed.

Let me explain my situation.

I have a big server with a lot of audio files, working within LAN, with
Windows 2000 Pro on it. Let's call it as "FileServer". Also I have another
server with Apache2 and PHP installed, windows 2000 PRO too, let's say it is
"WebServer". Web Server is standalone with two NIC cards, firewall, etc. I
don't want to make Fileserver be accessible form Internet.

The problem is that PHP and/or Apache on WebServer does not understand
mapped drives from a FileServer, so readdir() or opendir() is not working
correctly, by the way, it looks like Windows "dir" command works a little
bit faster than readdir();

It take me some time to play with simple Windows command line utility, to
get directory listing on FileServer and deliver plain text file to a
WebServer. Command line was the following:

exec('cmd /c dir /b /s /d /a:d \\\FileServer\\audiofiles > audiofiles.txt');

$hi = fopen("audiofiles.txt", "r");
$line = fread($hi,filesize("audiofiles.txt"));
fclose($hi);
$line=explode("\n", $line);


At this point I've got FileServer directories [only directories, not files!]
scanned into file audiofiles.txt and this file was written to a WebServer.
So, I have plain text file with correct directory structure, including
subdirectories.

The problem is, that "dir" command in Windows command prompt scans
directories in weird format - each directory in new line, eg:

\first
\second
\second\first
\second\second
\third

I immagine, to show directory tree, I need to make some like array in PHP,
and I think, this should be a recursive function [could not find out how to
write it]. So final variable should be array like this:

$directories = Array('\\first', '\\second" => Array('\\first', '\\second'),
'\\third');

How??

Thanks,

Bye, Dreiph


"Chris Ramsay" <raz.net@gmail.com> wrote in message
news:828f82cb0505180514542bcd35@mail.gmail.com...
Dreiph,

If you're familiar with PEAR, take a look at this:

http://pear.php.net/package/HTML_TreeMenu

regards

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация