DriveInfo 클래스

참고: 이 클래스는 .NET Framework 버전 2.0에서 새로 추가되었습니다.

드라이브 정보에 액세스합니다.

네임스페이스: System.IO
어셈블리: mscorlib(mscorlib.dll)

protected void Page_Load(object sender, EventArgs e)
    {

        DriveInfo[] allDrives = DriveInfo.GetDrives();

        foreach (DriveInfo d in allDrives)
        {
            Response.Write(string.Format("Drive {0}<br>", d.Name));
            Response.Write(string.Format("  File type: {0}<br>", d.DriveType));
            if (d.IsReady == true)
            {

                Response.Write(string.Format("  Volume label: {0}<br>", d.VolumeLabel));
                Response.Write(string.Format("  File system: {0}<br>", d.DriveFormat));
                Response.Write( string.Format("  Available space to current user:{0, 15} bytes<br>", d.AvailableFreeSpace) );

                Response.Write(string.Format("  Total available space:          {0, 15} bytes<br>", d.TotalFreeSpace));

                Response.Write(string.Format("  Total size of drive:            {0, 15} bytes<br> ", d.TotalSize));
            }
        }

    }

/*
This code produces output similar to the following:
Drive A:\
  File type: Removable
Drive C:\
  File type: Fixed
  Volume label:
  File system: FAT32
  Available space to current user:     4770430976 bytes
  Total available space:               4770430976 bytes
  Total size of drive:                10731683840 bytes
Drive D:\
  File type: Fixed
  Volume label:
  File system: NTFS
  Available space to current user:    15114977280 bytes
  Total available space:              15114977280 bytes
  Total size of drive:                25958948864 bytes
Drive E:\
  File type: CDRom
The actual output of this code will vary based on machine and the permissions
granted to the user executing it.
*/

ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.ko/cpref8/html/T_System_IO_DriveInfo.htm

DriveInfo 멤버

Public 생성자

이름
설명


DriveInfo
지정된 드라이브의 정보에 액세스합니다.

위쪽

Public 속성

이름
설명


AvailableFreeSpace
드라이브의 사용 가능한 공간을 나타냅니다.


DriveFormat
NTFS 또는 FAT32와 같은 파일 시스템의 이름을 가져옵니다.


DriveType
드라이브 형식을 가져옵니다.


IsReady
드라이브가 준비되었는지 여부를 나타내는 값을 가져옵니다.


Name
드라이브 이름을 가져옵니다.


RootDirectory
드라이브의 루트 디렉터리를 가져옵니다.


TotalFreeSpace
드라이브의 사용 가능한 공간 합계를 가져옵니다.


TotalSize
드라이브에 있는 저장소 공간의 크기 합계를 가져옵니다.


VolumeLabel
드라이브의 볼륨 레이블을 가져오거나 설정합니다.

http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo_members(VS.80).aspx

+ Recent posts