Attributes Property |
Description
Sets or returns the attributes of files. Read/write or read-only, depending on the attribute.
PowerBASIC Syntax
Arguments
Settings
The nAttributes argument can have any of the following values or any logical combination of the following values:
Example [PowerBASIC]
#INCLUDE "windows.inc" #INCLUDE "scrrun.inc"
DIM fso AS IFileSystem DIM pFile AS IFile DIM nAttr AS LONG DIM strAttr AS STRING
' Create an instance of the FileSystemObject fso = NEWCOM "Scripting.FileSystemObject" ' Get a reference to the IFile interface pFile = fso.GetFile(UCODE$("C:\MyFolder\MyFile.txt")) ' Get and display the attributes nAttr = pFile.Attributes IF nAttr = 0 THEN strAttr = "[Normal]" IF (nAttr AND 1) = 1 THEN strAttr += "[ReadOnly]" IF (nAttr AND 2) = 2 THEN strAttr += "[Hidden]" IF (nAttr AND 4) = 4 THEN strAttr += "[System]" IF (nAttr AND 8) = 8 THEN strAttr += "[Volume]" IF (nAttr AND 16) = 16 THEN strAttr += "[Directory]" IF (nAttr AND 32) = 32 THEN strAttr += "[Archive]" IF (nAttr AND 1024) = 1024 THEN strAttr += "[Alias]" IF (nAttr AND 2048) = 2048 THEN strAttr += "[Compressed]" MSGBOX "File attributes: " & strAttr
|