ASP 파일 개체


File 객체는 지정된 파일에 대한 정보를 반환하는 데 사용됩니다.


더 많은 예


지정된 파일이 마지막으로 수정된 날짜와 시간을 얻는 방법.


지정된 파일에 마지막으로 액세스한 날짜와 시간을 가져오는 방법.


의 속성을 반환하는 방법입니다.


파일 객체

File 객체는 지정된 파일에 대한 정보를 반환하는 데 사용됩니다.

File 개체의 속성과 메서드를 사용하려면 FileSystemObject 개체를 통해 File 개체의 인스턴스를 만들어야 합니다. 첫 번째; FileSystemObject 개체를 만든 다음 FileSystemObject 개체의 GetFile 메서드 또는 Folder 개체의 Files 속성을 통해 File 개체를 인스턴스화합니다.

다음 코드는 FileSystemObject 개체의 GetFile 메서드를 사용하여 File 개체를 인스턴스화하고 DateCreated 속성을 사용하여 지정된 파일이 생성된 날짜를 반환합니다.

예시

<%
Dim fs,f
Set fs=Server.CreateObject("Scripting.FileSystemObject")
Set f=fs.GetFile("c:\test.txt")
Response.Write("File created: " & f.DateCreated)
set f=nothing
set fs=nothing
%>


File 객체의 속성과 메서드는 다음과 같습니다.

속성

Property Description
Attributes Sets or returns the attributes of a specified file
DateCreated Returns the date and time when a specified file was created
DateLastAccessed Returns the date and time when a specified file was last accessed
DateLastModified Returns the date and time when a specified file was last modified
Drive Returns the drive letter of the drive where a specified file or folder resides
Name Sets or returns the name of a specified file
ParentFolder Returns the folder object for the parent of the specified file
Path Returns the path for a specified file
ShortName Returns the short name of a specified file (the 8.3 naming convention)
ShortPath Returns the short path of a specified file (the 8.3 naming convention)
Size Returns the size, in bytes, of a specified file
Type Returns the type of a specified file

행동 양식

Method Description
Copy Copies a specified file from one location to another
Delete Deletes a specified file
Move Moves a specified file from one location to another
OpenAsTextStream  Opens a specified file and returns a TextStream object to access the file