File System 객체

FileSystemObject 객체는 서버의 파일 시스템에 액세스하는 데 사용됩니다.

이 객체는 파일을 조작할 수 있습니다. 이 객체로 파일 시스템 정보를 검색할 수도 있습니다.

다음 코드는 텍스트 파일(c:\test.txt)을 생성한 다음 해당 파일에 텍스트를 작성합니다.

Dim fso, tso
Set fso = CreateObject("Scripting.FileSystemObject")
Set tso = fso.CreateTextFile("C:\test.txt", True)   ' Creates a text file (overwrites if exists).
tso.WriteLine("Hello, this is a test file.")        ' Writes text to the file.
tso.Close                                          ' Closes the file.

Set tso = Nothing
Set fso = Nothing