Questions tagged [driveinfo]
51 questions
2
votes
0 answers
How to get Total HardDrive available and used cpace in c#?
I have below code to get individual drive's information but I want the whole HDD informationie.I.E. total size and used or available space
public List GetDriveInfo()
{
List info = new…

madan mohan
- 78
- 5
2
votes
1 answer
System.IO.DriveInfo returns wrong disk space values
UPDATE : This issue doesn't appear on Android devices I've tested. It returns good values. Would really appreciate any pointers on this matter.
I am having trouble getting the correct AvailableFreeSpace values from my Mac desktop computer. I am…

Bypp
- 331
- 3
- 22
2
votes
3 answers
Best way to detect dvd insertion in drive c#
I tried using WMI to detect new media insertion in Disk Drive using following code. But is there managed solution like using loop in background thread with DriveInfo.GetDrives? Which is best way to do this? I'm getting 'Disk is not in the drive…

Ravi Patel
- 2,136
- 3
- 32
- 48
2
votes
1 answer
System.IO.DriveInfo.GetDrives() hangs with disconnected network drives
I am writing a file manager in .NET 3.5. At startup, the application must enumerate available drives. I am using DriveInfo.GetDrives to do that.
Unfortunately my users lamented that, when they have disconnected network drives, the application took…

seguso
- 2,024
- 2
- 18
- 20
2
votes
1 answer
DriveInfo with iSCSI drives
I have been planning on writing some code that checks the free space on numerous disks attached to a server, which are mounted using iSCSI.
It's been warned that "polling for free space on a dead mount causes a very long timeout".
My question is…

user132311
- 21
- 1
2
votes
2 answers
How to detect if application is running from a DVD?
I'm trying to detect if our application is running from a DVD (because this disables/enables functionality in the logic). So far I've come up with the code snippet below that seems to work, though I was really wondering if there's a best-practice in…

Amadeus Hein
- 706
- 1
- 4
- 12
1
vote
2 answers
Map a DiskIndex to a Volume Label
Current I am able to get all the Drives and their labels in c# by using the DriveInfo.GetDrives(). Then I am able to get the Disk Index / Index of the Partition by this methodology.
var searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT…

Brad Semrad
- 1,501
- 1
- 11
- 19
1
vote
1 answer
Device is not ready error on DriveInfo.DriveFormat
i have that method that retrieve the removable devices information which are NTFS :
private void getdriverinfo()
{
// get the usb flash driver
foreach (DriveInfo driveInfo in DriveInfo.GetDrives())
{
if…

R.Vector
- 1,669
- 9
- 33
- 41
1
vote
1 answer
Drive not ready condition while DVD media inserted. Why does this happen?
I have this code:
DriveInfo dr = new DriveInfo(@"E:\");
if (dr.IsReady == false)
{
MessageBox.Show("Drive E: is not ready. Please insert a blank DVD medium.");
}
So, I insert a blank DVD in the drive and run the code. What am I…

sparky
- 375
- 6
- 22
1
vote
4 answers
Check if there is more than x bytes on ANY drive c#
I'm kinda new to this so I'll just get to it.
I'm trying to figure out how to check if ANY drive has 30 GB disk space,
So far I can't seem to get it to do more than just checking the C: drive.
Probably has to do with the fact that…
user1071461
1
vote
4 answers
Formatting the result of DriveInfo's TotalSize in C#
So we all know that the following code will return a long:
DriveInfo myDrive = new DriveInfo("C:\\");
long size = myDrive.TotalSize;
Console.WriteLine("Drive Size is: {0}", size);
The output will be something like this:
Drive Size is:…

bobble14988
- 1,749
- 5
- 26
- 38
1
vote
1 answer
UWP - DriveInfo gives access denied for removable storage even if included in capability
I work on an UWP application who manage removable devices. So, I made sure to have this in the manifest.
I need to obtain the free and total space of the device. So, I…

sbeaudoin
- 158
- 2
- 11
1
vote
2 answers
Boolean check if any of the drives contain a specific drivetype
How do I write up a check that says something like this... If ANY (or if at least one) of the drive types are CDRom, then true/continue... else false (throw an error)?
Right now, I have it throwing an error for each drive check that does not pass…

Kala J
- 2,040
- 4
- 45
- 85
1
vote
3 answers
Check administrator permission while searching for files in C#
I am trying to get path of all EXE files present on my C drive. I am facing an issue which is nothing more than access problem due to lack of administrative rights.
I wrote this code,but the system is denying access to those files.
DriveInfo drive =…

Waqar Muhammad
- 27
- 8
1
vote
1 answer
C# DriveInfo.GetDrives () slow on select computer
I use the DriveInfo.GetDrives() method in my code to populate a combobox with all available and ready removable drives on my specified computer. It works great on three test computers, but on a single computer when the user clicks the button that…

Wesley Carlsen
- 137
- 3
- 19