Scripting Runtime Library(FileSystemObject)

ÁöÁ¤ÇÑ °æ·Î¿¡¼­ µå¶óÀ̺꿡 ÇØ´çÇÏ´Â Drive °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
object
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó FileSystemObjectÀÇ À̸§ÀÌ´Ù.
drivePath
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, drivePath Àμö´Â
  1. µå¶óÀÌºê ¹®ÀÚ(c),
  2. ÄÝ·ÐÀÌ Ãß°¡µÈ µå¶óÀÌºê ¹®ÀÚ(c:),
  3. Äݷаú °æ·Î ±¸ºÐ ±âÈ£°¡ Ãß°¡µÈ µå¶óÀÌºê ¹®ÀÚ(c:\),
  4. ¶Ç´Â ³×Æ®¿öÅ© °øÀ¯ ¿µ¿ª(\\computer\shareFolder)ÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ª oDriveÀº ÁöÁ¤ÇÑ °æ·Î¿¡¼­ µå¶óÀ̺꿡 ÇØ´çÇÏ´Â Drive °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.

¼³¸í

³×Æ®¿öÅ© °øÀ¯¿¡¼­´Â ³×Æ®¿öÅ© °øÀ¯ ¿µ¿ªÀÌ ÀÖ¾î¾ß ÇÑ´Ù.

drivePathÀÌ Çã¿ëµÈ ¾ç½Ä°ú ÀÏÄ¡ÇÏÁö ¾Ê°Å³ª drivePathÀÌ ¾øÀ¸¸é ¿À·ù°¡ ¹ß»ýÇÑ´Ù.

ÀÏ¹Ý °æ·Î ¹®ÀÚ¿­·Î GetDrive ¸Þ¼­µå¸¦ È£ÃâÇϸé drivePathÀ¸·Î »ç¿ëÇϱ⿡ ÀûÀýÇÑ ¹®ÀÚ¿­À» °¡Á®¿Â´Ù.


GetDrive ¸Þ¼­µå ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript GetDrive ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=JScript>
function GetDriveTest(drivePath){
  var fso,driveObj,str='';
  fso=new ActiveXObject('Scripting.FileSystemObject');
  driveObj=fso.GetDrive(fso.GetDriveName(drivePath));
  str='µå¶óÀ̺ê '+drivePath.toUpperCase()+' - '+driveObj.VolumeName+'<BR>';
  str+='»ç¿ë °¡´ÉÇÑ °ø°£: '+driveObj.FreeSpace/1024+'KB';
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="id=showjs.innerHTML=GetDriveTest('C:\\')">
  <SPAN class=ie>JScript</SPAN> <SPAN class=method>GetDrive</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScriptGetDrive ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=VBScript>
Function GetDriveTestvb(drivePath)
  Dim fso,driveObj,str
  Set fso=CreateObject("Scripting.FileSystemObject")
  Set driveObj=fso.GetDrive(fso.GetDriveName(drivePath))
  str="µå¶óÀ̺ê "&UCase(drivePath)&" - "&driveObj.VolumeName&"<BR>"
  str=str&"»ç¿ë °¡´ÉÇÑ °ø°£: "&FormatNumber(driveObj.FreeSpace/1024,0)&" KB"
  GetDriveTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=GetDriveTestvb('C:\\')">
  <SPAN class=ie>VBScript</SPAN><SPAN class=method>GetDrive</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>