Click here to Skip to main content
13,000,742 members (55,776 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i need to copy all the images from usb drive to local folder.currently i got the logical drive name.(my usb drive name is G).
Posted 31-Dec-12 22:40pm
Updated 31-Dec-12 22:45pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try something like this:
string usbRoot = @"H:\";
string destFolder = @"C:\CopiedTo";
string[] files = Directory.GetFiles(usbRoot, "*.jpg", SearchOption.AllDirectories);
foreach (string file in files)
    string dest = destFolder + file.Substring(usbRoot.Length);
    if (!Directory.Exists(Path.GetDirectoryName(dest)))
    File.Copy(file, dest, true);
joshi.ihsoj 2-Jan-13 4:25am
here in
string[] files = Directory.GetFiles(usbRoot, "*.jpg", SearchOption.AllDirectories);
i am not getting the files.the project is running mode,still waiting,and no response
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You can always check if a USB device is connected - A USB Library to Detect USB Devices[^].
Once this is done, read the drive just like you would read any other drive.
Use directory operations, you can read through the directory structure([^]) and filter out the image files.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170624.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100