ASP 파일 시스템 개체 개체


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


더 많은 예


파일이 존재하는지 확인하는 방법.


폴더가 있는지 확인하는 방법.


드라이브가 있는지 확인하는 방법.


의 이름을 가져오는 방법.


의 상위 폴더 이름을 가져오는 방법.


가져오기 지정된 경로에서 마지막 구성 요소의 파일 이름을 가져오는 방법입니다.


가져오기 지정된 경로에서 마지막 구성 요소의 파일 확장자를 가져오는 방법입니다.


의 기본 이름 가져오기 지정된 경로에서 파일 또는 폴더의 기본 이름을 가져오는 방법입니다.


FileSystemObject 개체

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

이 개체는 파일, 폴더 및 디렉터리 경로를 조작할 수 있습니다. 이 개체를 사용하여 파일 시스템 정보를 검색할 수도 있습니다.

다음 코드는 텍스트 파일(c:\test.txt)을 만든 다음 파일에 일부 텍스트를 씁니다.

<%
dim fs,fname
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("c:\test.txt",true)
fname.WriteLine("Hello World!")
fname.Close
set fname=nothing
set fs=nothing
%>


FileSystemObject 개체의 속성 및 메서드는 다음과 같습니다.

속성

Property Description
Drives Returns a collection of all Drive objects on the computer

행동 양식

Method Description
BuildPath Appends a name to an existing path
CopyFile Copies one or more files from one location to another
CopyFolder Copies one or more folders from one location to another
CreateFolder Creates a new folder
CreateTextFile Creates a text file and returns a TextStream object that can be used to read from, or write to the file
DeleteFile Deletes one or more specified files
DeleteFolder Deletes one or more specified folders
DriveExists Checks if a specified drive exists
FileExists Checks if a specified file exists
FolderExists Checks if a specified folder exists
GetAbsolutePathName Returns the complete path from the root of the drive for the specified path
GetBaseName Returns the base name of a specified file or folder
GetDrive Returns a Drive object corresponding to the drive in a specified path
GetDriveName Returns the drive name of a specified path
GetExtensionName Returns the file extension name for the last component in a specified path
GetFile Returns a File object for a specified path
GetFileName Returns the file name or folder name for the last component in a specified path
GetFolder Returns a Folder object for a specified path
GetParentFolderName Returns the name of the parent folder of the last component in a specified path
GetSpecialFolder Returns the path to some of Windows' special folders
GetTempName Returns a randomly generated temporary file or folder
MoveFile Moves one or more files from one location to another
MoveFolder Moves one or more folders from one location to another
OpenTextFile Opens a file and returns a TextStream object that can be used to access the file