8.9.8 IsFileAttribute or IsFileAttr (check a folder or file attribute)
- Purpose
-
Checks whether a folder or file has a specific attribute and returns True or False.
- Syntax
IsFileAttribute (PathName, Attribute) IsFileAttr (PathName, Attribute)
- Arguments
-
- PathName
-
Specify the full path of the folder or file as a string or as a variable that stores this value.
- Attribute
-
Specify one of the following attributes to check:
Value
Meaning
ATTR_READONLY
Read-only file
ATTR_HIDDEN
Hidden file
ATTR_ARCHIVE
Archive file
ATTR_SUBDIR
Sub-directory
ATTR_SYSTEM
System file
ATTR_TEMPORARY
Temporary file
ATTR_COMPRESSED (from version 05-20)
Compressed file
- Description
-
The IsFileAttribute or IsFileAttr command checks whether the specified folder or file has a specific attribute. The command returns True if the folder or file has the attribute, or False if not.
To set folder or file attributes, use the SetFileAttribute command. To acquire the attributes of a folder or file, use the GetFileAttribute command
- Note
-
Take care when specifying the folder, or a folder or file in the folder set in the following environment variables: ProgramFiles (normally the Program Files folder on the system drive) and WinDir (normally the Windows folder on the system drive). For details, see 1.8.2 Command behavior.
- Example
' Delete a file if it has the temporary file attribute. Dim file1 file1 = "C:\TEMP\logging.tmp" If IsFileAttribute (file1, ATTR_TEMPORARY) = True Then DeleteFile (file1) End
- JP1/Script version
-
Supported from JP1/Script 01-00.