Dim fso As New FileSystemObject Private Sub Command1_Click() 'Normal 0 Normal file. No attributes are set. 'ReadOnly 1 Read-only file. Attribute is read/write. 'Hidden 2 Hidden file. Attribute is read/write. 'System 4 System file. Attribute is read/write. 'Volume 8 Disk drive volume label. Attribute is read-only. 'Directory 16 Folder or directory. Attribute is read-only. 'Archive 32 File has changed since last backup. Attribute is read/write. 'Alias 64 Link or shortcut. Attribute is read-only. 'Compressed 128 Compressed file. Attribute is read-only. Dim file1 As File Set file1 = fso.GetFile("D:\AdobeWeb.log")
Dim i As Integer i = file1.Attributes Select Case i Case 0 MsgBox "正常" Case 1 MsgBox "只读" Case 2 MsgBox "隐藏" Case 4 MsgBox "系统" Case 8 MsgBox "驱动器" Case 16 MsgBox "文件夹" Case 32 MsgBox "文档" Case 64 MsgBox "快捷方式" Case 128 MsgBox "压缩" End Select
Private Sub Command1_Click()
'Normal 0 Normal file. No attributes are set.
'ReadOnly 1 Read-only file. Attribute is read/write.
'Hidden 2 Hidden file. Attribute is read/write.
'System 4 System file. Attribute is read/write.
'Volume 8 Disk drive volume label. Attribute is read-only.
'Directory 16 Folder or directory. Attribute is read-only.
'Archive 32 File has changed since last backup. Attribute is read/write.
'Alias 64 Link or shortcut. Attribute is read-only.
'Compressed 128 Compressed file. Attribute is read-only. Dim file1 As File
Set file1 = fso.GetFile("D:\AdobeWeb.log")
Dim i As Integer
i = file1.Attributes
Select Case i
Case 0
MsgBox "正常"
Case 1
MsgBox "只读"
Case 2
MsgBox "隐藏"
Case 4
MsgBox "系统"
Case 8
MsgBox "驱动器"
Case 16
MsgBox "文件夹"
Case 32
MsgBox "文档"
Case 64
MsgBox "快捷方式"
Case 128
MsgBox "压缩"
End Select
Set file1 = Nothing
Set fso = Nothing
End Sub