Scripting Runtime Library(FileSystemObject)

ÁöÁ¤µÈ Æú´õ°¡ ·çÆ® Æú´õÀ̸é true¸¦, ¾Æ´Ï¸é false¸¦ ¹ÝȯÇÑ´Ù.

Àμö
object : (°³Ã¼)

object´Â Ç×»ó Folder °³Ã¼ÀÌ´Ù.

: (¼Ó¼º ºÎ¿ï°ª)
¼Ó¼º°ªÀº ÁöÁ¤µÈ Æú´õ°¡ ·çÆ® Æú´õÀΰ¡¸¦ ³ªÅ¸³»´Â ºÎ¿ï°ªÀÌ´Ù.

true ÁöÁ¤µÈ Æú´õ°¡ ·çÆ® Æú´õÀÌ´Ù.
false ÁöÁ¤µÈ Æú´õ°¡ ·çÆ® Æú´õ°¡ ¾Æ´Ï´Ù.

ÀÌ ¼Ó¼ºÀº ÀбâÀü¿ëÀÌ¸ç µðÆúÆ®°ªÀº ¾ø´Ù.


IsRootFolder ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript IsRootFolder ¼Ó¼º ¿¹Á¦
<SCRIPT language=JScript>
function IsRootFolderTest(folderPath){
  var fso,folderObj,numb,str='';
  fso=new ActiveXObject('Scripting.FileSystemObject');
  if (!fso.FolderExists(folderPath)) fso.CreateFolder(folderPath);
  folderObj=fso.GetFolder(folderPath);
  numb=0;
  if (folderObj.IsRootFolder)
    str='ÁöÁ¤ÇÑ Æú´õ "'+folderPath+'"°¡ ·çÆ® Æú´õÀÌ´Ù.'
  else{
    str='Æú´õ "'+ folderPath+'"´Â ·çÆ® Æú´õ°¡ ¾Æ´Ï´Ù.<BR>';
    while (!folderObj.IsRootFolder){
      folderObj=folderObj.ParentFolder;
      numb++;
    }
    str+='ÁöÁ¤ÇÑ Æú´õ´Â ·çÆ® Æú´õ·ÎºÎÅÍ '+numb+'¹ø° »óÀ§¿¡ À§Ä¡ÇÏ°í ÀÖ´Ù.<BR>';
    str+='Æú´õ "'+ folderObj+'"°¡ ·çÆ® Æú´õÀÌ´Ù.'
  }
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showjs.innerHTML=IsRootFolderTest('C:\\JsTest\\test')">
  <SPAN class=ie>JScript</SPAN> <SPAN class=property>IsRootFolder</SPAN> ¼Ó¼º ¿¹Á¦</DIV>

VBScript·Î ¹Ýº¹

°á°ú Ç¥½Ãâ
VBScript IsRootFolder ¼Ó¼º ¿¹Á¦
<SCRIPT language=VBScript>
Function IsRootFolderTestvb(folderPath)
  Dim fso,folderObj,numb,str
  Set fso=CreateObject("Scripting.FileSystemObject")
  If Not fso.FolderExists(folderPath) Then
    fso.CreateFolder(folderPath)
  End If
  Set folderObj=fso.GetFolder(folderPath)
  If folderObj.IsRootFolder Then
    str="ÁöÁ¤ÇÑ Æú´õ '"&folderPath&"'´Â ·çÆ® Æú´õÀÌ´Ù."
  Else
    str="Æú´õ '"&folderPath&"'´Â ·çÆ® Æú´õ°¡ ¾Æ´Ï´Ù.<BR>"
    Do Until folderObj.IsRootFolder
      Set folderObj=folderObj.ParentFolder
      numb=numb+1
    Loop
    str=str&"ÁöÁ¤ÇÑ Æú´õ´Â ·çÆ® Æú´õ·ÎºÎÅÍ "&numb&" ¹ø° »óÀ§¿¡ À§Ä¡ÇÏ°í ÀÖ´Ù.<BR>"
    str=str&"Æú´õ '"&folderObj&"'°¡ ·çÆ® Æú´õÀÌ´Ù."
  End If
  IsRootFolderTestvb=str
End Function
</SCRIPT>

<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=IsRootFolderTestvb('C:\\JsTest\\test')">
  <SPAN class=ie>VBScript</SPAN> <SPAN class=property>IsRootFolder</SPAN> ¼Ó¼º ¿¹Á¦</DIV>