Scripting Runtime Library(FileSystemObject)

ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õÀÇ »óÀ§ Æú´õ¿¡ ÇØ´çÇÏ´Â Æú´õ °³Ã¼¸¦ ¹ÝȯÇÑ´Ù. ÀбâÀü¿ëÀÌ´Ù.

Àμö
objec
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, object´Â Ç×»ó File ¶Ç´Â Folder °³Ã¼ÀÌ´Ù.

: (¼Ó¼º °³Ã¼)
¼Ó¼º°ªÀº °³Ã¼ÀÇ °èÅëµµ »ó °³Ã¼ÀÇ ¹Ù·Î »óÀ§ÀÇ °³Ã¼ÀÌ´Ù.

ÁöÁ¤ÇÑ ÆÄÀÏÀ̳ª Æú´õÀÇ ¹Ù·Î »óÀ§ Æú´õ¿¡ ÇØ´çÇÏ´Â Æú´õ °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.

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


ParentFolder ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
Jscript ParentFolder ¼Ó¼º ¿¹Á¦
<SCRIPT language=JScript>
function ParentFolderTest(filePath){
  var fso,fileObj,str;
  fso=new ActiveXObject('Scripting.FileSystemObject');
  if (!fso.FileExists(filePath)){ // ¿À·ù ¹æÁö¸¦ À§ÇÏ¿© È­ÀÏÀÌ ¾øÀ¸¸é »ý¼ºÇÑ´Ù.
    fileObj=fso.OpenTextFile(filePath,2,true);
    fileObj.Write(filePath+' È­ÀÏ');
    fileObj.Close();
  }
  fileObj=fso.GetFile(filePath);
  folderObj=fileObj.ParentFolder
  str='File "'+fileObj.Name+'"Àº "'+folderObj+'" Folder¿¡ ÀÖ´Ù.<BR><BR>';
  str+='File: "'+fileObj+'"<BR>';
  str+='File ¸¸µç ³¯Â¥: '+fileObj.DateCreated+'<BR>';
  str+='File ¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥: '+fileObj.DateLastModified+'<BR><BR>';
  str+='ParentFolder: "'+folderObj+'"<BR>';
  str+='Folder ¸¸µç ³¯Â¥: '+folderObj.DateCreated+'<BR>';
  str+='Folder ¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥: '+fileObj.DateLastModified+'<BR><BR>';
  str+='ParentFolderÀÇ ParentFolder: "'+folderObj.ParentFolder+'"<BR>';
  return(str);
}
</SCRIPT>

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

VBScript·Î ¹Ýº¹

°á°ú Ç¥½Ãâ
Jscript ParentFolder ¼Ó¼º ¿¹Á¦
<SCRIPT language=VBScript>
function ParentFolderTestvb(filePath)
  Dim fso,fileObj,str
  Set fso=CreateObject("Scripting.FileSystemObject")
  If Not fso.FileExists(filePath) Then ' ¿À·ù ¹æÁö¸¦ À§ÇÏ¿© ¿øº» È­ÀÏÀÌ ¾øÀ¸¸é »ý¼ºÇÑ´Ù.
    Set fileObj=fso.OpenTextFile(filePath,2,true)
    fileObj.Write filePath&" È­ÀÏ"
    fileObj.Close
  End If
  Set fileObj=fso.GetFile(filePath)
  Set folderObj=fileObj.ParentFolder
  str="File '"&fileObj.Name&"'Àº '"&folderObj&"' Folder¿¡ ÀÖ´Ù.<BR><BR>"
  str=str&"File: '"&fileObj&"'<BR>"
  str=str&"File ¸¸µç ³¯Â¥: "&fileObj.DateCreated&"<BR>"
  str=str&"File ¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥: "&fileObj.DateLastModified&"<BR><BR>"
  str=str&"ParentFolder: '"&folderObj&"'<BR>"
  str=str&"Folder ¸¸µç ³¯Â¥: "&folderObj.DateCreated&"<BR>"
  str=str&"Folder ¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥: "&fileObj.DateLastModified&"<BR><BR>"
  str=str&"ParentFolderÀÇ ParentFolder: '"&folderObj.ParentFolder&"'<BR>"
  ParentFolderTestvb=str
End Function
</SCRIPT>

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