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

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
 
T

Tony Wissler

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top