Get USB drive's letter Get USB drive's letter arielap (TechnicalUser) (OP) 19 Dec 09 17:22 This app reads from and backs up data files to a USB thumb drive.The problem is that the USB drive is used with several machines and its allocated drive letter varies. How can I determine the USB's current drive letter?(VFP7 and XP) RE: Get USB drive's letter shavon (Programmer) 19 Dec 09 20:35 This might be helpful. From MSDN(http://msdn.microsoft.com/en-us/library/ys4ctaz0%28VS.85%29.aspx)Function ShowDriveType(drvpath) Dim fso, d, t Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(drvpath) Select Case d.DriveType Case 0: t = "Unknown" Case 1: t = "Removable" Case 2: t = "Fixed" Case 3: t = "Network" Case 4: t = "CD-ROM" Case 5: t = "RAM Disk" End Select ShowDriveType = "Drive " & d.DriveLetter & ": - " & tEnd Function RE: Get USB drive's letter strongm (MIS) 21 Dec 09 06:40 Dores the thunmb drive not have a volume name? And if not, can one be set?If the answer to either of the above is 'yes', then you can use the FSO to iterate through the attached drives interrogating the VolumeName propery until you find the drive you want. Something like the following:CODE Dim objDrive As Object With CreateObject("Scripting.FileSystemObject") For Each objDrive In .Drives If objDrive.IsReady Then ' skip unready drives such as empty CD and DVD drives If objDrive.VolumeName = "Example" Then MsgBox "Drive is " & objDrive.Path Exit For End If End If Next End With RE: Get USB drive's letter arielap (TechnicalUser) (OP) 24 Dec 09 14:26 thanks - looks as though drivetype() will do the job RE: Get USB drive's letter dilettante (MIS) 25 Dec 09 01:24 This sort of thing seems clever... until you run into cases where more than one removable drive is encountered.People do use ReadyBoost for one thing, and some still have floppy drives. RE: Get USB drive's letter arielap (TechnicalUser) (OP) 26 Dec 09 15:43 Thanks; this should be OK though.It's for a dedicated netbook, running a VFP app and (for security reasons) using only data kept on a single protected USB stick. RE: Get USB drive's letter strongm (MIS) 28 Dec 09 12:08 >the USB drive is used with several machines and its allocated drive letter varies>It's for a dedicated netbookHow do theses two statements tally? RE: Get USB drive's letter arielap (TechnicalUser) (OP) 29 Dec 09 18:12 How do theses two statements tally? The netbook is used by an on-call technician to run a specific VFP app (tissue typing for heart/lung transplants) when needed out of lab hours.The data files used are on a security locked USB key.Each evening the USB key is updated from the server via one of the networked day-time PCs. Changed files are transferred back to the lab network next morning via any free PC.And drivetype() does do the job thanks RE: Get USB drive's letter strongm (MIS) 29 Dec 09 19:45 I'm sure it does. But eithera) it is for a dedicated machine, in which case drive letters won't change, so drivetype() will work without issue - but is not actually neededb) it is for multiple machines, in which case drive letters change and may change because they have different numbers of removeable drives in which case drivetype() won't work 100% of the time (dilettante's point)All we are saying is be careful. RE: Get USB drive's letter arielap (TechnicalUser) (OP) 30 Dec 09 11:00 >> All we are saying is be careful.<< Thanks - it'll be error trapped. (I know xp can do odd things with external drive letter allocation) RE: Get USB drive's letter dilettante (MIS) 30 Dec 09 16:27 Yes, what I was suggesting comes down to supplying a DriveListBox to let the user choose the correct drive. You could make your own selecting only removable drives and displaying the volume name in order to help the user make the correct selection. RE: Get USB drive's letter dpaulson (Programmer) 30 Dec 09 18:49 Check this post out. I don't know if it can help you any further.http://www.codeguru.com/vb/gen/vb_system/win32/article.php/c14935/ David Paulson RE: Get USB drive's letter strongm (MIS) 30 Dec 09 19:41 Detecting a USB insertion (which isn't quite what the OP was about) in VB6 is substantially easier than that article indicates. And we've covered it here in thread222-1171051: Detecting USB device getting plugged in. RE: Get USB drive's letter arielap (TechnicalUser) (OP) 31 Dec 09 14:29 thanks everyone - I don't know how this got into the VB forum .It's for a VFox application and I thought I was in that forum when I sent the original message.