VB如何改变文件属性

来源:百度知道 编辑:UC知道 时间:2024/06/21 03:10:45
用VB对一些文件的属性进行改变 如像.BAT中attrib一样
最好给个代码 本人谢谢了

Function ChangeFileAttributes(strPath As String, _
Optional lngSetAttr As FileAttribute, _
Optional lngRemoveAttr As FileAttribute, _
Optional blnRecursive As Boolean) As Boolean

' This function takes a directory path, a value specifying file
' attributes to be set, a value specifying file attributes to be
' removed, and a flag that indicates whether it should be called
' recursively. It returns True unless an error occurs.

Dim fsoSysObj As FileSystemObject
Dim fdrFolder As Folder
Dim fdrSubFolder As Folder
Dim filFile As File

' Return new FileSystemObject.
Set fsoSysObj = New FileSystemObject

On Error Resume Next
' Get folder.
Set fdrFolder = fsoSysObj.GetFolder(strPath)
If Err <> 0 Then