Jump to content

reading "My Computer" using readdir - to list all logical/physical drive names


kumiko

Recommended Posts

Hi,

Was wondering if anyone could help me with this...

I'm currently developing a backup app on winxp using php. Need to read the first level of the directory tree with readdir(). If we use windows explorer, we could just type My Computer in the address, and we will get back all the logical and physical drives on the harddisk (e.g. c:\, d:\, e:\, f:\, etc.)

I've checked everywhere on the internet. readdir($start_path) seems to require exact path name to start with (such as c:\). There seems to be no way to specify something like readdir("My Computer")

Does anyone know how to retrieve all the logical/physical drive names with php on winxp? With the drive names, I could then plug into readdir() and retrieve the directory contents of each drive.

Thanks in advance for your help...

...kumiko
[quote author=thorpe link=topic=119060.msg487122#msg487122 date=1166421483]
Do a search for infomation about the windows scripting.filesystem object. You will need to accesss it through [url=http://php.net/com]COM[/url].
[/quote]

Anyone mind shedding a bit more light to this stuff about COM.

I'm new to COM. Have looked at the php.net/COM page. So what should I put inside
[pre]$domainObject = new COM("what_should_be_this?"); [/pre]
to get a list of the logical/physical drives?

Thanks and Regards,
...kumiko
You would need to use...

[code=php:0]
$domainObject = new COM("scripting.filesystemobject");
[/code]

but as I said, you would need to look up the docs for the scripting.filesystem object, its been a long while since Ive dealt with any COM objects or windows scripting.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.