Scripting Runtime Library(FileSystemObject)

ÁÖ¾îÁø °æ·Î¿¡¼­ Á¤È®ÇÑ Àüü °æ·Î¸¦ ¹ÝȯÇÑ´Ù.

Àμö/ÆĶó¸ÞÅÍ
object
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Ç×»ó FileSystemObjectÀÇ À̸§ÀÌ´Ù.
objPath
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, Á¤È®ÇÑ Àüü °æ·Î·Î ¹Ù²Ü °æ·ÎÀÌ´Ù.
¹Ýȯ°ª

¹Ýȯ°ª sValÀº Àý´ë ÁÖ¼Ò °æ·ÎÀÇ ¹®ÀÚ¿­ÀÌ´Ù.

¼³¸í

°æ·Î¸¦ ÁöÁ¤ÇÑ µå¶óÀ̺êÀÇ ·çÆ®¿¡¼­ Àüü¸¦ ÂüÁ¶ÇÏ¸é ±× °æ·Î°¡ Á¤È®ÇÑ Àüü °æ·Î°¡ µÈ´Ù.
Àüü °æ·Î°¡ ¿¬°áµÈ µå¶óÀ̺êÀÇ ·çÆ® Æú´õ¸¦ ÁöÁ¤Çϸé Àüü °æ·Î´Â °æ·Î ±¸ºÐ ±âÈ£(\)·Î ³¡³ª¾ß ÇÑ´Ù.

ÇöÀç µð·ºÅ͸®¸¦c:\JsTest\test¶ó°í °¡Á¤ÇßÀ» ¶§ GetAbsolutePathname ¸Þ¼­µå´Â ´ÙÀ½°ú °°´Ù.

objPath GetAbsolutePathname
'c:' 'c:\JsTest\test'
'c:..' 'c:\JsTest'
'c:\\' 'c:\'
'c:testSub' 'c:\JsTest\test\testSub'
'CopyTest' 'c:\JsTest\test\CopyTest'
'c:\\..\\..\\JsTest' 'c:\JsTest'


GetAbsolutePathname ¸Þ¼­µå ¿¹Á¦

<SCRIPT language=JScript>
drivePath=GetDriveName(GetAbsolutePathname(Path));
</SCRIPT>
°á°ú Ç¥½Ãâ
JScript 'testcopy.txt' FileExist ¸Þ¼­µå ¿¹Á¦
JScript 'JsTest' FileExist ¸Þ¼­µå ¿¹Á¦
<SCRIPT language=JScript>
function getAbsPath(objPath){
  var fso,str='';
  fso=new ActiveXObject('Scripting.FileSystemObject');
  baseObj=fso.GetFolder('C:\\JsTest\\test');
  str+=objPath+' : '+fso.GetAbsolutePathname(objPath)+'<BR>';
  str+=objPath+' : '+fso.GetBaseName(objPath)+'<BR>';
  str+=objPath+' : '+fso.GetSpecialFolder(objPath)+'<BR>';
  return(str);
}
</SCRIPT>

<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showjs.innerHTML=getAbsPath('testcopy.txt')">
  <SPAN class=ie>JScript</SPAN> 'testcopy.txt' <SPAN class=method>FileExist</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
<DIV class=show onClick="showjs.innerHTML=getAbsPath('C:\\JsTest\\testfile.txt')">
  <SPAN class=ie>JScript</SPAN> 'C:\\JsTest\\testfile.txt' <SPAN class=method>FileExist</SPAN> ¸Þ¼­µå ¿¹Á¦</DIV>
<SCRIPT language=VBScript>
drivePath=GetDriveName(GetAbsolutePathname(Path))
</SCRIPT>