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 생성자
이름
설명
지정된 드라이브의 정보에 액세스합니다.
이름
설명
드라이브의 사용 가능한 공간을 나타냅니다.
DriveFormat
NTFS 또는 FAT32와 같은 파일 시스템의 이름을 가져옵니다.
DriveType
드라이브 형식을 가져옵니다.
IsReady
드라이브가 준비되었는지 여부를 나타내는 값을 가져옵니다.
Name
드라이브 이름을 가져옵니다.
RootDirectory
드라이브의 루트 디렉터리를 가져옵니다.
TotalFreeSpace
드라이브의 사용 가능한 공간 합계를 가져옵니다.
TotalSize
드라이브에 있는 저장소 공간의 크기 합계를 가져옵니다.
VolumeLabel
드라이브의 볼륨 레이블을 가져오거나 설정합니다.
http://msdn2.microsoft.com/ko-kr/library/system.io.driveinfo_members(VS.80).aspx
'C#.NET IO' 카테고리의 다른 글
[System.Data.Linq.Binary / SaveFileDialog ] 파일 저장하기 (0) | 2010.08.03 |
---|---|
[Linq.Binary]초간단 openFileDialog 파일 읽기/쓰기 (0) | 2010.04.06 |
구조체와 클래스를 파일로 입력 및 출력 (0) | 2010.01.03 |
디렉토리생성시 중복디렉토리 네임 방지 (0) | 2010.01.03 |
[ DriveInfo ] 하드 디스크 정보 및 사용량을 알고 싶을때 (0) | 2010.01.03 |
파일 중복체크해서 저장하기 (0) | 2009.12.15 |
[Serialize] 클래스 파일로 저장하기 및 불러오기 (0) | 2009.12.15 |
응용 프로그램의 현재 작업 디렉터리를 가져오기 (0) | 2009.04.27 |