driveinfo

How to correctly convert filesize in bytes into mega or gigabytes?

I'm using the DriveInfo class in my C# project to retrieve the available bytes on given drives. How to I correctly convert this number into Mega- or Gigabytes? Dividing by 1024 will not do the job I guess. The results always differ from those shown in the Windows-Explorer. ...

.Net DriveInfo() with UNC paths?

Good morning, is there a way to get a DriveInfo instance for UNC paths (e.g. "\fors343a.ww123.somedomain.net\folder\1\") because for example... var driveInfo = new System.IO.DriveInfo(drive); ... throws an ArgumentException ("Object must be a root directory (\"C:\\") or a drive letter (\"C\").") when using that UNC path above. What...

How to get the list of removable disk in c# ?

I want to get the list of removable disk in c#. I want to skip the local drives. Because i want the user to save the file only in removable disk. Thanks. Urgent ...

System.IO.DriveInfo.GetDrives() hangs with disconnected network drives

Hi, 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 about 30 seconds to start. I discovered that the GetDrives() function hangs for many...

C# - Mapped network drives cannot be listed

Hi I am trying to list all local drives in my app, and DriveInfo.GetDrives give back the local drive letters, and I need the mapped drives too. Currently I have: C,D,G (HDD), E,F (CD), and S,Z (Mapped network drives) (Yes, they are all visible in the Explorer, and in Total Commander too) But only the C,D,E,F,G are retreived programmatic...