728x90
728x170
using System;
using System.Runtime.InteropServices;
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Auto)]
static extern bool GetDiskFreeSpaceEx
(
string directoryName , // 디렉토리명
out ulong userFreeByteCount , // 사용자 잔여 바이트 카운트
out ulong userTotalByteCount, // 사용자 전체 바이트 카운트
out ulong totalFreeByteCount // 전체 잔여 바이트 카운트
);
string directory = "c:\\";
ulong userFreeByteCount;
ulong userTotalByteCount;
ulong totalFreeByteCount;
GetDiskFreeSpaceEx(directory, out userFreeByteCount, out userTotalByteCount, out totalFreeByteCount);
Console.WriteLine(string.Format("전체 공간 : {0} 바이트", userTotalByteCount ));
Console.WriteLine(string.Format("잔여 공간 : {0} 바이트", userAvailableByteCount));
728x90
그리드형(광고전용)
'C# > Common' 카테고리의 다른 글
[C#/COMMON] 휴지통으로 파일 보내기 (0) | 2016.06.01 |
---|---|
[C#/COMMON] 휴지통으로 디렉토리 보내기 (0) | 2016.06.01 |
[C#/COMMON] BASE64 문자열 구하기 (0) | 2016.06.01 |
[C#/COMMON] 텍스트 파일 읽기 (0) | 2016.06.01 |
[C#/COMMON] 바이트 배열 구하기 (0) | 2016.06.01 |
[C#/COMMON] DirectoryInfo 클래스 : 디렉토리 삭제하기 (읽기 전용 파일까지 포함) (0) | 2016.06.01 |
[C#/COMMON] Thread 클래스 : 람다 표현식을 사용해 인자 전달하기 (0) | 2016.05.05 |
[C#/COMMON] Thread 클래스 : 스레드 메소드에 인자 전달하기 (0) | 2016.05.05 |
[C#/COMMON] Thread 클래스 : 클래스 객체를 사용해 인자 전달하기 (0) | 2016.05.05 |
[C#/COMMON] Process 클래스 : ProcessorAffinity 속성을 사용해 현재 프로세스의 스레드 실행을 예약할 수 있는 프로세서 설정하기 (0) | 2016.05.05 |