Server hard disk space operations

Source: Internet
Author: User
Driveinfo [] Alldrive =Driveinfo. Getdrives ();// Obtain an array of driveinfo objects, representing all logical partitions of the current computer

Foreach(DriveinfoItemInAlldrive)

{

If(Item. isready)// Check whether the disk space is readable. An exception is not readable.

{

If(Item. Name. toupper (). tostring () ="E :\\")

{

// Item. Name. tostring () +"Disk; "available space:" +

This. Lbllast. Text + = (item. availablefreespace/(1024*1024). tostring () +"MB";

}

}

}

The driveinfo class allows you to obtain information about the computer drive. In general, the driveinfo class is only used to obtain the size of the remaining disk space.

Driveinfo class member

Totalsize: obtains the total size of the drive, in bytes, including allocated and unallocated.

Totalfreespace: obtains the total remaining disk space in bytes.

The size of the available disk space obtained by auailablefreespace, in bytes. However, if you use the disk quota to limit the available space of ASP. NET processes, the available space may be less than the total available space.

Driveformat returns the name of the file system used by the drive (for example, NTFS or FAT32)

Drivetype returns a drivetype enumeration value that indicates whether the drive is fixed, network, CD-ROM, Ram, or removable (unknow is returned if the drive type is not determined)

Isready returns whether the drive is ready for reading or writing

Name returns the drive letter (such as C: Or e :)

Volumelabel returns the drive volume label. In a drive partitioned in NTFS format, the volume tag can contain a maximum of 32 characters. If no value is set, null is returned.

Rootdirectory: returns the directoryinfo object in the root directory of the drive.

Getdrives () gets an array of driveinfo objects, representing all the logical partitions of the current computer.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.