Display attributes of a file

This displays the attributes of a specified file. Here are a list of what the cryptic possibilities are.

0 = Normal file
1 = Read-only file
2 = Hidden file
4 = System file
16 = Folder or directory
32 = File has changed since last backup
1024 = Link or shortcut
2048 = Compressed file

<%
'our variables
Dim objFSO , myFile
'create instances of the objcts
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set myFile = objFSO.GetFile(Server.MapPath("sample.txt"))
'display relevant info
Response.Write "The file attributes of the file are " & myFile.Attributes
'set objects to nothing (good practice at all times)
Set objFSO = Nothing
Set myFile = Nothing
%>

 

Sponsors