Scripting Runtime Library(FileSystemObject)
ÆÄÀÏÀÇ ¸ðµç ¼Ó¼º¿¡ ¾×¼¼½ºÇÒ ¼ö ÀÖ´Ù.
|
Script |
[propVal=]..propName;
..methodName(parameters); |
HTML |
¾ø´Ù. |
- Àμö
-
- fileObj : (ÆÄÀϸí)
È£ÃâµÈ File °³Ã¼ÀÌ´Ù.
ActiveXObject¸¦ È°¼ºÈ½ÃÅ°°í GetFile ¸Þ¼µåµîÀ¸·Î File °³Ã¼¸¦ È£Ãâ ÇÑ´Ù.
- propertyName : (¼Ó¼º¸í)
-
propertyNameÀº ¾Æ·¡ ¼³¸íµÈ ¼Ó¼ºµé Áß ÇϳªÀÌ´Ù.
- File °³Ã¼ È£Ãâ ¹æ½Ä
-
- GetFile ¸Þ¼µå
fileObj=fsoName.GetFile(filePath)
- Files Ä÷º¼Ç¿¡¼
fileCol=fsoName.GetFolders(filePath).Files
- Ç׸ñ Key·Î Item È£Ãâ
fileObj=fileCol.Item(keyVal)
- Enumerator °³Ã¼¸¦ ¸¸µé¾î
fileObj=enumObj.item()
- ÈÀÏ »ý¼º
- CreateTextFile ¸Þ¼µå
fileObj=fsoName.CreateTextFile(filePath,true)
- OpenTextFile ¸Þ¼µå
fileObj=fsoName.OpenTextFile(filePath,ForReading,false)
- OpenAsTextStream ¸Þ¼µå
fileObj=fsoName.OpenAsTextStream(filePath,IOmode,format)
File °³Ã¼¸¦ °¡Á®¿À°í ¼Ó¼ºÀ» ¹ÝȯÇÏ´Â ¿¹Á¦
°á°ú Ç¥½Ãâ
JScript File °³Ã¼ ¿¹Á¦
<SCRIPT language=JScript>
function FileTest(filePath) {
var fso,fileObj,str='';
fso=new ActiveXObject('Scripting.FileSystemObject')
if (!fso.FileExists(filePath)){
fileObj=fso.OpenTextFile(filePath,2,true);
fileObj.WriteLine('¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù.');
fileObj.Close();
str+='¿øº» ÆÄÀÏÀÌ ¾ø¾î '+filePath+' ÆÄÀÏÀ» »ý¼ºÇÏ¿´´Ù.<BR>';
}
fileObj=fso.GetFile(filePath);
str+='"'+fileObj+'"ÀÇ »ý¼ºÀÏÀº '+fileObj.DateCreated ;
return(str);
}
</SCRIPT>
<DIV id=showjs class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="id=showjs.innerHTML=FileTest('C:\\JsTest\\CreateText.txt')">
<SPAN class=ie>JScript</SPAN> <SPAN class=object>File</SPAN> °³Ã¼ ¿¹Á¦</DIV>
°á°ú Ç¥½Ãâ
VBScript File °³Ã¼ ¿¹Á¦
<SCRIPT language=VBScript>
Function FileTestvb(filePath)
Dim fso,fileObj
str=""
Set fso=CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(filePath) Then
Set fileObj=fso.OpenTextFile(filePath,2,True)
fileObj.WriteLine "¿¹Á¦¸¦ À§ÇÑ ÆÄÀÏÀÌ´Ù."
fileObj.Close
str=str&"¿øº» ÆÄÀÏÀÌ ¾ø¾î "&filePath&" ÆÄÀÏÀ» »ý¼ºÇÏ¿´´Ù.<BR>"
End If
Set fileObj=fso.GetFile(filePath)
str=str&"'"&fileObj&"'ÀÇ »ý¼ºÀÏÀº "&fileObj.DateCreated
FileTestvb=str
End Function
</SCRIPT>
<DIV id=showvb class=show alt="°á°ú">°á°ú Ç¥½Ãâ</DIV>
<DIV class=show onClick="showvb.innerHTML=FileTestvb('C:\\JsTest\\CreateText.txt')">
<SPAN class=ie>VBScript</SPAN> <SPAN class=object>File</SPAN> °³Ã¼ ¿¹Á¦</DIV>
Attributes ¼Ó¼º
IE4 -
¢¡ ÆÄÀÏÀÇ ¼Ó¼º ÀμöÀÇ °¹¼ö ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
¹®¹ý: .Attributes[=sVal]
DateCreated ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏ°¡ ¸¸µé¾îÁø ³¯Â¥¿Í ½Ã°£À» ¹ÝȯÇÑ´Ù. Àбâ Àü¿ëÀÌ´Ù.
¹®¹ý: [dVal=].DateCreated
DateLastAccessed ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏ¿¡ ¸¶Áö¸·À¸·Î ¾×¼¼½ºÇÑ ³¯Â¥¿Í ½Ã°£À» ¹ÝȯÇÑ´Ù. Àбâ Àü¿ëÀÌ´Ù.
¹®¹ý: [dVal=].DateLastAccessed
DateLastModified ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀϸ¦ ¸¶Áö¸·À¸·Î ¼öÁ¤ÇÑ ³¯Â¥¿Í ½Ã°£À» ¹ÝȯÇÑ´Ù. Àбâ Àü¿ëÀÌ´Ù.
¹®¹ý: [dVal=].DateLastModified
Drive ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀÌ ÀÖ´Â µå¶óÀ̺êÀÇ µå¶óÀÌºê ¹®ÀÚ¸¦ ¹ÝȯÇÑ´Ù. Àбâ Àü¿ëÀÌ´Ù.
¹®¹ý: [oVal=].Drive
name ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀÇ À̸§À» ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù. Àбâ/¾²±â°¡ °¡´ÉÇÏ´Ù.
¹®¹ý: .name[=sVal]
ParentFolder ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀÇ »óÀ§ Æú´õ¿¡ ÇØ´çÇÏ´Â Æú´õ °³Ã¼¸¦ ¹ÝȯÇÑ´Ù. Àбâ Àü¿ëÀÌ´Ù.
¹®¹ý: [oVal=].ParentFolder
Path ¼Ó¼º
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏ, Æú´õ, ¶Ç´Â µå¶óÀ̺êÀÇ °æ·Î¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: [sVal=].Path
ShortName ¼Ó¼º
IE4 -
¢¡ ¿¹Àü ¸í¸í ±ÔÄ¢À» µû¸£´Â ÇÁ·Î±×·¥¿¡¼ »ç¿ëµÇ´Â ªÀº À̸§À» ¹ÝȯÇÑ´Ù.
¹®¹ý: [sVal=].ShortName
ShortPath ¼Ó¼º
IE4 -
¢¡ ¿¹Àü ¸í¸í ±ÔÄ¢À» µû¸£´Â ÇÁ·Î±×·¥¿¡¼ »ç¿ëµÇ´Â ªÀº °æ·Î¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: [sVal=].ShortPath
Size ¼Ó¼º
IE4 -
¢¡ ÆÄÀÏÀÇ Å©±â¸¦ ¹ÙÀÌÆ® ´ÜÀ§·Î ¹ÝȯÇÑ´Ù.
¹®¹ý: [iVal=].Size
Type ¼Ó¼º
IE4 -
¢¡ ÆÄÀÏÀÇ Çü½Ä¿¡ °üÇÑ Á¤º¸¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: [sVal=].Type
Copy ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀϸ¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î º¹»çÇÑ´Ù.
¹®¹ý: .Copy(destination,overwrite)
Delete ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀϸ¦ »èÁ¦ÇÑ´Ù.
¹®¹ý: .Delete(force)
Move ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀϸ¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î ¿Å±ä´Ù.
¹®¹ý: .Move(destination)
OpenAsTextStream ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀ» ¿°í, ÆÄÀÏÀ» Àаųª, ¾²°Å³ª, Ãß°¡ÇÏ´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ´Â TextStream °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: [oVal=].OpenAsTextStream(IOmode,format)