Scripting Runtime Library(FileSystemObject)
Scripting Runtime Library¿¡¼ ÄÄÇ»ÅÍÀÇ ÆÄÀÏ ½Ã½ºÅÛ¿¡ ¾×¼¼½ºÇÒ ¼ö ÀÖ´Ù.
|
Script |
[fsoObj=]new ActiveXObject('Scripting.FileSystemObject'); |
HTML |
¾ø´Ù. |
- Àμö
-
- propertyName : (¼Ó¼º¸í)
- ¼±ÅÃÀû ¿ä¼ÒÀ̸ç FileSystemObject °³Ã¼¿Í ¿¬°áµÈ ¸ðµç ¼Ó¼ºµé Áß ÇϳªÀÌ´Ù.
- methodName : (¸Þ¼µå¸í)
- ¼±ÅÃÀû ¿ä¼ÒÀ̸ç FileSystemObject °³Ã¼¿Í ¿¬°áµÈ ¸ðµç ¸Þ¼µåµé Áß ÇϳªÀÌ´Ù.
ÅؽºÆ® ÆÄÀÏÀ» ¸¸µé¾î ÀúÀåÇÏ´Â ¿¹Á¦
¾Æ·¡ ÄÚµå´Â FileSystemObject¸¦ »ç¿ëÇÏ¿© Àаųª ¾µ ¼ö ÀÖ´Â TextStream °³Ã¼¸¦ ¹ÝȯÇÏ´Â ¹æ¹ýÀ» º¸¿©ÁØ´Ù.
JScript
¿¹Á¦ ÆäÀÌÁö ÄÚµå
<HTML>
<HEAD>
<TITLE>FileSystemObject ¿¹Á¦ ÆäÀÌÁö</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=euc-kr">
<SCRIPT language=Javascript>
var fileSysObj=new ActiveXObject('Scripting.FileSystemObject');
var fsoText=fileSysObj.CreateTextFile('c:\\testfile.txt', true);
fsoText.WriteLine('Å×½ºÆ® ÆÄÀÏ ³»¿ëÀÌ´Ù.');
fsoText.Close();
</SCRIPT>
</HEAD>
<BODY>
<center><BR>
<a href="c:\\testfile.txt">»ý¼ºµÈ ÆÄÀÏ º¸±â</a><BR>
À§Ä¡ : "c:\\testfile.txt"<BR><BR>
<FORM><INPUT type="button" value="â´Ý±â" onClick="self.close()"></FORM></center>
</BODY>
</html>
ÇöÀç ÆäÀÌÁö ÄÚµå
<FORM>
<INPUT type=button value="»õâÀ¸·Î ¿¹Á¦ ¿±â"
onClick="newWin=window.open('../object/exp/wFSO.html','test','height=180,width=350')">
<INPUT type=button value="»õ⠴ݱâ" onClick="newWin.close()"></FORM>
¿¹Á¦ ÄÚµå´Â ActiveXObject °³Ã¼¸¦ FileSystemObject(fileSysObj)·Î ÇÒ´çÇÑ ´ÙÀ½ CreateTextFile ¸Þ¼µå´Â ÆÄÀÏÀ» TextStream °³Ã¼(fsoText)·Î ¸¸µé°í, WriteLine ¸Þ¼µå´Â ¸¸µé¾îÁø ÅؽºÆ® ÆÄÀÏ¿¡ ÅؽºÆ® ÇÑ ÁÙÀ» ¾´´Ù. ³¡À¸·Î Close ¸Þ¼µå´Â ¹öÆÛ¸¦ ºñ¿î ´ÙÀ½ ÇØ´ç ÆÄÀÏÀ» ´Ý´Â´Ù.
VBScript·Î
¾Æ·¡ ÄÚµå´Â VBScript·Î °°Àº ³»¿ëÀÇ ¿äÁ¡À» º¸¿©ÁØ´Ù.
VBScript
<SCRIPT language=VBScript>
Dim fileSysObj,fileObj
Set fileSysObj=CreateObject('Scripting.FileSystemObject')
Set fsoText=fileSysObj.CreateTextFile('c:\testfile.txt', True)
fsoText.WriteLine('Å×½ºÆ® ÆÄÀÏ ³»¿ëÀÌ´Ù.')
fsoText.Close
</SCRIPT>
¼±Çà Äڵ忡¼ CreateObject() ±â´ÉÇÔ¼ö´Â FileSystemObject(fileSysObj)¸¦ ¹ÝȯÇÑ´Ù. ±×·¯¸é CreateTextFile ¸Þ¼µå´Â ÆÄÀÏÀ» TextStream °³Ã¼(fsoText)·Î ¸¸µé°í WriteLine ¸Þ¼µå´Â ¸¸µé¾îÁø ÅؽºÆ® ÆÄÀÏ¿¡ ÅؽºÆ® ÇÑ ÁÙÀ» ¾´´Ù. ³¡À¸·Î Close ¸Þ¼µå´Â ¹öÆÛ¸¦ ºñ¿î ´ÙÀ½ ÇØ´ç ÆÄÀÏÀ» ´Ý´Â´Ù.
Drives(
°³Ã¼) ¼Ó¼º
IE4 -
¢¡ ·ÎÄà ÄÄÇ»ÅÍ¿¡ »ç¿ëÇÒ ¼ö ÀÖ´Â ¸ðµç
Drive °³Ã¼·Î ±¸¼ºµÈ
Drives Ä÷º¼ÇÀ» ¹ÝȯÇÑ´Ù.
¹®¹ý: DrivesCol=.Drives
BuildPath ¸Þ¼µå
IE4 -
¢¡ ±âÁ¸ °æ·Î¿¡ À̸§À» Ãß°¡ÇÑ´Ù
¹®¹ý: .BuildPath(folderPath,name)
CopyFile ¸Þ¼µå
IE4 -
¢¡ Çϳª ÀÌ»óÀÇ ÆÄÀÏÀ» ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î º¹»çÇÑ´Ù.
¹®¹ý: .CopyFile(source,destination[,overwrite])
CopyFolder ¸Þ¼µå
IE4 -
¢¡ Æú´õ¸¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î ¹Ýº¹ º¹»çÇÑ´Ù.
¹®¹ý: .CopyFolder(source,destination[,overwrite])
CreateFolder ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤µÈ Æú´õ¸¦ ¸¸µç´Ù.
¹®¹ý: .CreateFolder(foldername)
CreateTextFile ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤µÈ ÆÄÀÏ À̸§À» ¸¸µé°í ±× ÆÄÀÏÀ» Àаųª ¾²´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ´Â TextStream °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .CreateTextFile(filename[,overwrite[,unicode]])
DeleteFile ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀ» »èÁ¦ÇÑ´Ù.
¹®¹ý: .DeleteFile(filePath[,force])
DeleteFolder ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ Æú´õ¿Í Æú´õÀÇ ³»¿ëÀ» »èÁ¦ÇÑ´Ù.
¹®¹ý: .DeleteFolder(folderPath[,force])
DriveExists ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ µå¶óÀ̺갡 ÀÖÀ¸¸é true¸¦, ±×·¸Áö ¾ÊÀ¸¸é false¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .DriveExists(drivePath)
FileExists ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀÌ ÀÖÀ¸¸é true¸¦, ±×·¸Áö ¾ÊÀ¸¸é false¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .FileExists(filePath)
FolderExists ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ Æú´õ°¡ ÀÖÀ¸¸é true¸¦, ±×·¸Áö ¾ÊÀ¸¸é false¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .FolderExists(folderPath)
GetAbsolutePathname ¸Þ¼µå
IE4 -
¢¡ ÁÖ¾îÁø °æ·Î¿¡¼ Á¤È®ÇÑ Àüü °æ·Î¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetAbsolutePathname(objPath)
GetBaseName ¸Þ¼µå
¢¡ È®Àå¸íÀÌ ¾ø´Â °æ·Î¿¡¼ ¸¶Áö¸· ±¸¼º ¿ä¼ÒÀÇ ±âº» À̸§À» Æ÷ÇÔÇÑ ¹®ÀÚ¿À» ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetBaseName(objPath)
GetDrive ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ °æ·Î¿¡¼ µå¶óÀ̺꿡 ÇØ´çÇÏ´Â Drive °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetDrive(drivePath)
GetDriveName ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ °æ·Î¿¡¼ µå¶óÀ̺ê À̸§À» Æ÷ÇÔÇÏ´Â ¹®ÀÚ¿À» ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetDriveName(drivePath)
GetExtensionName ¸Þ¼µå
IE4 -
¢¡ °æ·ÎÀÇ ¸¶Áö¸· ±¸¼º ¿ä¼Ò¿¡ ÇØ´çÇÏ´Â È®ÀåÀÚ ¹®ÀÚ¿À» ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetExtensionName(objPath)
GetFile ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ °æ·Î¿¡¼ ƯÁ¤ ÆÄÀÏ¿¡ ÇØ´çÇÏ´Â File °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetFile(filePath)
GetFileName ¸Þ¼µå
IE4 -
¢¡ µå¶óÀ̺êÀÇ ÀϺκÐÀÌ ¾Æ´Ñ ÁöÁ¤ÇÑ °æ·ÎÀÇ ¸¶Áö¸· ±¸¼º ¿ä¼Ò¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetFileName(filePath)
GetFolder ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ °æ·Î¿¡¼ Æú´õ¿¡ ÇØ´çÇÏ´Â Folder °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetFolder(folderPath)
GetParentFolderName ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ °æ·Î¿¡¼ ¸¶Áö¸· ±¸¼º ¿ä¼ÒÀÇ »óÀ§ Æú´õ À̸§À» Æ÷ÇÔÇÑ ¹®ÀÚ¿À» ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetParentFolderName(objPath)
GetSpecialFolder ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ Æ¯Á¤ Æú´õ °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetSpecialFolder(folderPath)
GetTempName ¸Þ¼µå
IE4 -
¢¡ Àӽà ÆÄÀÏÀ̳ª Æú´õ°¡ ÇÊ¿äÇÑ ¿¬»êÀ» ¼öÇàÇÏ´Â µ¥ À¯¿ëÇÑ ÀÓÀ¸·Î ¸¸µç Àӽà ÆÄÀÏÀ̳ª Æú´õ À̸§À» ¹ÝȯÇÑ´Ù.
¹®¹ý: .GetTempName()
MoveFile ¸Þ¼µå
IE4 -
¢¡ Çϳª ÀÌ»óÀÇ ÆÄÀÏÀ» ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î ¿Å±ä´Ù.
¹®¹ý: .MoveFile(source,destination)
MoveFolder ¸Þ¼µå
IE4 -
¢¡ Çϳª ÀÌ»óÀÇ Æú´õ¸¦ ±âÁ¸ À§Ä¡¿¡¼ ´Ù¸¥ À§Ä¡·Î ¿Å±ä´Ù.
¹®¹ý: .MoveFolder(source,destination)
OpenTextFile ¸Þ¼µå
IE4 -
¢¡ ÁöÁ¤ÇÑ ÆÄÀÏÀ» ¿°í ±× ÆÄÀÏÀ» Àаųª, ¾²°Å³ª, Ãß°¡ÇÏ´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ´Â TextStream °³Ã¼¸¦ ¹ÝȯÇÑ´Ù.
¹®¹ý: .OpenTextFile(filename[,iomode[,create[,format]]])