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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file write to drive ...

Status
Not open for further replies.

KryptoS

Programmer
Feb 7, 2001
240
BE
Hello,

I'm writing a file to my gps. Now for me, my gps, is drive I:. But the problem is that when someone from my company plug his gps in his computer at home that it can be E:, F:, ...
We have all TomTom gps in the company and the drive is also called TomTom. So to avoid problems, can I write a file using TomTom instead of I:\blabla.txt?

Greetings,
Wim

The One And Only KryptoS
 
How about looping through all the drive letters (from A to Z) and, inside the loop, search for a certain file with file_exists() ? If file_exists returns TRUE, then you have it.
 
nice idea, can do that...

euhm... how do I loop through all the drive letters? :-s

The One And Only KryptoS
 
Something like this :

Code:
$drives = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

for ($i = 0; $i <= strlen($drives); $i++) {

    if (file_exists($drives[$i] . ":\\tomtom\\")) {
    
    // do something in this drive
    
    }

}

Not sure it will work though.
 
nice, works fine, with a few changes for my application.
But still if there is a sollution for using drive-name. I would like to hear it.

thanks man.

Greets

The One And Only KryptoS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top