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 생성자

이름
설명


:Track('ctl00_LibFrame_ctl02|ctl00_LibFrame_ctl03',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.driveinfo(VS.80).aspx">DriveInfo


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

위쪽

Public 속성

이름
설명


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl05',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.availablefreespace(VS.80).aspx">AvailableFreeSpace


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


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl06',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.driveformat(VS.80).aspx">DriveFormat
NTFS 또는 FAT32와 같은 파일 시스템의 이름을 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl07',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.drivetype(VS.80).aspx">DriveType
드라이브 형식을 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl08',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.isready(VS.80).aspx">IsReady
드라이브가 준비되었는지 여부를 나타내는 값을 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl09',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.name(VS.80).aspx">Name
드라이브 이름을 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl10',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.rootdirectory(VS.80).aspx">RootDirectory
드라이브의 루트 디렉터리를 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl11',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.totalfreespace(VS.80).aspx">TotalFreeSpace
드라이브의 사용 가능한 공간 합계를 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl12',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.totalsize(VS.80).aspx">TotalSize
드라이브에 있는 저장소 공간의 크기 합계를 가져옵니다.


:Track('ctl00_LibFrame_ctl04|ctl00_LibFrame_ctl13',this);" href="http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo.volumelabel(VS.80).aspx">VolumeLabel
드라이브의 볼륨 레이블을 가져오거나 설정합니다.

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

+ Recent posts