Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

drive list

Status
Not open for further replies.

BB101

Programmer
Joined
May 23, 2001
Messages
337
Location
GB
How can I get a list of drives on the server from PHP.

I know I can do it with a filesystem object, but I'd like to avoid com if at all possible!

Thanks


--BB
 
Going with an OS-specific solution like COM may be the only way to do it.

PHP is developed on a unix-like OS and ported to Win32. Unix-like OSes do not support the quaint idea of drive letters.

Want the best answers? Ask the best questions: TANSTAAFL!
 
:) I did expect to see one on php.net though, and I did end up using a com call to scripting.filesystem :o(

Anyway, for anyone who cares:

$fso = new COM("Scripting.FileSystemObject");
$drives = $fso->Drives;
$drives = $drives->Next($drives->Count);
$first = true;
foreach ($drives as $drive) {
echo $drive->DriveLetter.&quot;<br>&quot;;
}

All the other drive properties from fso can be used too.

--BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top