Scripting Runtime Library(FileSystemObject)

ÁöÁ¤ÇÑ ÆÄÀÏ, Æú´õ, ¶Ç´Â µå¶óÀ̺êÀÇ °æ·Î¸¦ ¹ÝȯÇÑ´Ù.

Àμö
objec : (°³Ã¼)

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

: (¼Ó¼º ¹®ÀÚ¿­)
¼Ó¼º°ªÀº °³Ã¼ÀÇ °æ·Î¸¦ ³ªÅ¸³»´Â ¹®ÀÚ¿­ÀÌ´Ù.

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

Ư±â

µå¶óÀÌºê ¹®ÀÚ¿¡ ·çÆ® µå¶óÀ̺ê´Â Æ÷ÇÔµÇÁö ¾Ê´Â´Ù.
¿¹¸¦ µé¾î, C µå¶óÀ̺êÀÇ °æ·Î´Â C:\°¡ ¾Æ´Ï¶ó C:ÀÌ´Ù.


Path ¼Ó¼º ¿¹Á¦

°á°ú Ç¥½Ãâ
JScript Path ¼Ó¼º ¿¹Á¦
<SCRIPT language=JScript>
function PathTest(filePath){
  var fso,driveObj,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);
  str='File °æ·Î="'+fileObj.Path.toUpperCase()+'"<BR>';
  folderObj=fileObj.ParentFolder;
  str+='ParentFolder °æ·Î="'+folderObj.Path.toUpperCase()+'"<BR>';
  return(str);
}
</SCRIPT>

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

VBScript·Î ¹Ýº¹

°á°ú Ç¥½Ãâ
VBScript Path ¼Ó¼º ¿¹Á¦
<SCRIPT language=VBScript>
Function PathTestvb(filePath)
  Dim fso,driveObj,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)
  str="File °æ·Î='"&UCase(fileObj.Path)&"'<BR>"
  Set folderObj=fileObj.ParentFolder
  str=str&"ParentFolder °æ·Î='"&UCase(folderObj.Path)&"'<BR>"
  PathTestvb=str
End Function
</SCRIPT>

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