Directories of removable disk Using DiretoryInfo
Hi Programmers, can you help me on how can i get the directories of a certain flash drive using DirectoryInfo in C#?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
VulpesRank #55 · 29.2K reputationPosted Dec 19, 2013, 5:35 AM EST
Akemi Chou12 reputationPosted Dec 19, 2013, 7:38 AM EST
The question is; how can I make it default or let's just say the system could easily identify without mapping it manually with the use of DirectoryInfo? thanks for your reply :)
VulpesRank #55 · 29.2K reputationPosted Dec 19, 2013, 9:09 AM EST
Otherwise, the only thing I can think of is to give it a unique Volume Label and then identify it from that:
If the flash drive doesn't have a unique volume label already, then you can give it one with the LABEL command:
http://en.wikipedia.org/wiki/Label_(command)
Akemi Chou12 reputationPosted Dec 19, 2013, 4:03 PM EST
VulpesRank #55 · 29.2K reputationPosted Dec 20, 2013, 2:31 PM EST
Akemi Chou12 reputationPosted Dec 22, 2013, 3:26 AM EST
VulpesRank #55 · 29.2K reputationPosted Dec 23, 2013, 1:42 AM EST
You can guard against this error by changing the code to the following: