How to access a local drive (including removable drive) in a terminal server session programmaticall

  • Thread starter Thread starter Bill Nguyen
  • Start date Start date
B

Bill Nguyen

One of my apps (running in a terminal server session) needs to access a
local USB drive /fash card.
Is there a way to access local drives programmatically?

Thanks

Bill
 
I don't have a code sample handy right here but yes, if your looking to read
or write to a file on removable drive, that shouldn't be a problem at all.
I read/write to files all the time.

Look into the FileSystemInfo, FileInfo, DirectoryInfo classes.

Also and more specifically,take a look at the DriveInfo class and the
DriveInfo.DriveType enumeration.

You can enumerate drives on a system with something along the lines of the
following:

Dim drives() As DriveInfo = DriveInfo.GetDrives()
Dim drive As DriveInfo
For Each drive In drives
Console.WriteLine("Drive: {0}", drive.Name)
Console.WriteLine("Type: {0}", drive.DriveType)
Next

This should give you a start.

Tony Wissler
(e-mail address removed)_NoSpamMan!
 
Back
Top