Programmatically read file(s) from a USB device

  • Thread starter Thread starter domtam
  • Start date Start date
D

domtam

Suppose I have one of those USB storage devices (like a mp3 player, USB
thumbdrive, or even digital camera) connected to my computer. I'd like
to write a C# program that can

- detect that the USB device is connected, and then
- read file(s) from that USB device.

How can I do that? Any reference?

Thanks a lot in advance
Dom
 
Suppose I have one of those USB storage devices (like a mp3 player, USB
thumbdrive, or even digital camera) connected to my computer. I'd like
to write a C# program that can

- detect that the USB device is connected, and then
- read file(s) from that USB device.

It's just a disk drive; you read files the same way as from any other disk.
 
Thanks for your reply.

When I plug in my USB drive, a pop-up saying "USB device detected" will
be displayed and then the USB drive will be displayed as a new drive
letter. How can I find out that the USB device is detected / connected?
Also, which drive letter has it been assigned to?

Dom
 
I am not sure if this would help, but there is a library available from
the makers of SharpDevelop [a free IDE for .NET] called sharpusblib.
Just google the name and visit their site, to see if it will be of
help to you...
 
Hi dom, this has been discussed before, and it can be a bit involved,
but there are two topics in this group
(microsoft.public.dotnet.languages.csharp) which helped me when i was
looking.

'c# code detect inset/remove events at usb port'
'get drive letter( Win32_Diskdrive)'

If you searched (i'm on googlegroups) there are code examples. if you
can't find them, let me know, i'll dig out my code :)
 
Back
Top