ASP Attributes 속성

정의 및 사용법

Attributes 속성은 지정된 파일이나 폴더의 속성을 설정하거나 반환합니다.

문법:

FileObject.Attributes[=newattributes]
FolderObject.Attributes[=newattributes]
파라미터 설명
newattributes

선택 사항. 파일이나 폴더의 속성 값을 지정합니다.

다음 중 하나 또는 그 组합을 사용할 수 있습니다:

  • 0 = 일반 파일. 어떤 속성도 설정되지 않았습니다.
  • 1 = 읽기 전용 파일. 읽기 및 쓰기 가능.
  • 2 = 숨겨진 파일. 읽기 및 쓰기 가능.
  • 4 = 시스템 파일. 읽기 및 쓰기 가능.
  • 16 = 폴더나 디렉토리. 읽기 전용.
  • 32 = 최근 백업 후 변경된 파일. 읽기 및 쓰기 가능.
  • 1024 = 링크나 단축 방식. 읽기 전용.
  • 2048 = 압축 파일. 읽기 전용.

File 객체에 대한 예제

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("c:\test.txt")
Response.Write("파일의 속성은: ")
Response.Write("}}")f.Attributes)
set f=nothing
fs=nothing 설정
%>

출력:

파일의 속성은: 32

Folder 객체에 대한 예제

<%
dim fs,fo
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fo=fs.GetFolder("c:\test")
Response.Write("文件夹的属性是: ")
Response.Write("}}")fo.Attributes)
fo=nothing 설정
fs=nothing 설정
%>

출력:

폴더의 속성은: 16