<%
Set fs = Server.CreateObject("Scripting.FileSystemObject")
Set c_drive = fs.GetDrive("c:")
Set g_drive = fs.GetDrive("g:")
Set h_drive = fs.GetDrive("h:")

Dim cmax, gmax, hmax
Dim c, g, h
Dim cper, gper, hper
Dim cfmt, gfmt, hfmt
Dim gbyte
gbyte = 1024*1024*1024

' C, G, H 드라이브 총 용량
cmax = CInt(c_drive.TotalSize / gbyte)
gmax = CInt(g_drive.TotalSize / gbyte)
hmax = CInt(h_drive.TotalSize / gbyte)

' C, G, H 드라이브 남은 용량
c = CInt(c_drive.FreeSpace / gbyte)
g = CInt(g_drive.FreeSpace / gbyte)
h = CInt(h_drive.FreeSpace / gbyte)

'남은 비율 계산
div100 = cmax / 100
cper = CInt(c / div100)
div100 = gmax / 100
gper = CInt(g / div100)
div100 = hmax / 100
hper = CInt(h / div100)

'NTFS, FAT, FAT32등 드라이브 포멧형식
cfmt = c_drive.FileSystem
gfmt = g_drive.FileSystem
hfmt = h_drive.FileSystem

%>
<html>
<head>
<title> 하드 드라이브 용량 알아내기 </title>
</head>

<body style="font-size:9pt;">
<h1>하드 드라이브 용량 체크 예제</h1><p>

<b>C: 드라이브의 용량<b> : <%=cmax%> / <%=c%> GB [남은 비율:<%=cper%>%] 형식:<%=cfmt%><br>
<table border="0" height="50" style="font-size:9pt;" cellspacing="0">
<tr>
<td align="center" bgcolor="#FF0000" width="<%=600-(cper*6)%>">사용 용량(<%=cmax%>GB)</td>
<td align="center" bgcolor="#00FF00" width="<%=cper*6%>">사용 가능 용량(<%=c%>GB)</td>
</tr>
</table>
<p>
<b>G: 드라이브의 용량<b> : <%=gmax%> / <%=g%> GB [남은 비율:<%=gper%>%] 형식:<%=gfmt%><br>
<table border="0" height="50" style="font-size:9pt;" cellspacing="0">
<tr>
<td align="center" bgcolor="#FF0000" width="<%=600-(gper*6)%>">사용 용량(<%=gmax%>GB)</td>
<td align="center" bgcolor="#00FF00" width="<%=gper*6%>">사용 가능 용량(<%=g%>GB)</td>
</tr>
</table>
<p>
<b>H: 드라이브의 용량<b> : <%=hmax%> / <%=h%> GB [남은 비율:<%=hper%>%] 형식:<%=hfmt%><br>
<table border="0" height="50" style="font-size:9pt;" cellspacing="0">
<tr>
<td align="center" bgcolor="#FF0000" width="<%=600-(hper*6)%>">사용 용량(<%=cmax%>GB)</td>
<td align="center" bgcolor="#00FF00" width="<%=hper*6%>">사용 가능 용량(<%=h%>GB)</td>
</tr>
</table>
</body>
</html>

2011/11/19 11:47 2011/11/19 11:47

Trackback Address :: https://youngsam.net/trackback/1657