Questions tagged [driveinfo]
51 questions
1
vote
1 answer
C# - Drive is not Ready (DriveInfo)
I have this small problem with the DriveInfo Class.
I know that the error is specific to the "IsReady" Property but I just don't know how to define it..
namespace Csp.Test.ConsoleApp
{
public class Program
{
public static void…

Ghostyy
- 77
- 3
- 10
0
votes
0 answers
How to Find PNPDeviceID for Disk any Drive
I use this code for get all drive in pc:
using System;
using System.IO;
class Info {
public static void Main() {
DriveInfo[] drives = DriveInfo.GetDrives();
foreach (DriveInfo drive in drives) {
…

Ashin Best
- 21
- 5
0
votes
1 answer
Get free disk space in two loop
I'm looking for a way to get disk size information in two cycles, but I'm having difficulty.
TotalFreeSpace not recognized.
List NamesDrive = new List();
string[] LogicalDrives = System.IO.Directory.GetLogicalDrives();
foreach…

Joh Travell
- 71
- 3
0
votes
1 answer
How to get SAN drive information in C#?
I need to check all the drives and their free available space. As for Fixed Drives we can get information using DriveInfo class (System.IO), but I need to check drive information for SAN drives.

Shivam Choudhary
- 1
- 1
0
votes
0 answers
Get users mapped network drives from a service
I have a windows service that I use to monitor PC stats and health and one of its features is monitoring hard drive space. But I would also like to keep an eye on mapped network drives as well.
System.IO.DriveInfo contains everything I need,…

Wobbles
- 3,033
- 1
- 25
- 51
0
votes
1 answer
How to discover usb mass storage device (external hard drive) ?
I have tried these 2 different function but it doesn't work as expected.
How to determine if drive is external drive <- the method provided on this also returns true for usb thumbdrive. But, i am looking specifically for external hard drive.
…

posh
- 31
- 7
0
votes
2 answers
How to change the 'friendly label' of a volume in Windows?
I want to change this label:
In the above picture I changed it manually without any permissions.
I tryed the following as said in this thread but it gives an System.UnauthorizedAccessException
public void setVolumeLabel(String oldName, string…

tec
- 999
- 3
- 18
- 40
0
votes
1 answer
what code is make to treeview node expand
private void Form1_Load(object sender, EventArgs e)
{
foreach (DriveInfo drv in DriveInfo.GetDrives())
{
if (drv.IsReady)
{
TreeNode t2 = new TreeNode();
t2.Text = drv.Name;
…

Ji-yong Kim
- 1
- 1
0
votes
0 answers
IIS does not see the virtual disks on the local system
The system has a virtual disk connected to another server (M:) There is an application on IIS that requires access to files on this virtual disk.
DriveInfo[] dis = DriveInfo.GetDrives();
Returns the disks A, C, D, F - ie Local drives and discs.
In…

Valery Yegorov
- 171
- 1
- 11
0
votes
1 answer
Free disk space calculated using C# doesn't match the value shown in My Computer
I used the following method to calculate free disk space using DriveInfo class. But it doesn't match the free disk space value shown in My Computer. Following method returns 106 gb of free space while MyComputer only shows a free space of 98.8 GB.…

AnOldSoul
- 4,017
- 12
- 57
- 118
0
votes
3 answers
Casting List of type string to DeviceInfo[]
Is it possible to cast list of type string to DeviceInfo[]. I am fetching list of logical drives on my computer and casting it to list to remove my system directory(My Operating System directory). Now I want to cast that list back to DeviceInfo[] as…

Partha
- 21
- 1
- 1
- 5
0
votes
1 answer
Check whether drive is main drive
I've got a DriveInfo object.
I want to find out whether the drive is the Windows Drive(on my PC it's C:) because you can't right to the root directory of the Windows Drive.

trinalbadger587
- 1,905
- 1
- 18
- 36
0
votes
0 answers
How to find the true CD-Rom drive letter when a virtual drive is also installed?
I'm trying to detect a CD-ROM drive in an app, I'm using
ComboBox cb = new ComboBox();
var drives = DriveInfo.GetDrives();
foreach (var drive in drives)
{
if (drive.DriveType == DriveType.CDRom)
{
…

Exception
- 71
- 1
- 9
0
votes
3 answers
Simplifying logic to avoid duplicate error messages
So far I have the following:
// Gets all the drives
DriveInfo[] allDrives = DriveInfo.GetDrives();
// checks if any CD-Rom exists in the drives
var cdRomExists = allDrives.Any(x => x.DriveType == DriveType.CDRom);
// Get all the cd roms
var…

Kala J
- 2,040
- 4
- 45
- 85
0
votes
1 answer
System.IO.DriveInfo equivalent for a WinJS application
Is there any way to retrieve the available disk space from within a WinJS application?
I've found information on creating windows runtime components, and then including those in your application, but it doesn't look like System.IO.DriveInfo is…

derekadk
- 214
- 2
- 6