大概这个样子:'引用部件 Microsoft Script Control 1.0 Dim fsPrivate Sub Command1_Click() Dim d, dc, n On Error GoTo EH Set fs = CreateObject("Scripting.FileSystemObject") Set dc = fs.Drives For Each d In dc If d.DriveType = 3 Then n = d.ShareName Else n = d.VolumeName End If ScanPath Next Exit Sub EH: n = "" Resume Next End SubPrivate Sub ScanPath(Byval PathName As String) Dim f, f1, fc, sf, s1 Set f = fs.GetFolder(PathName) Set fc = f.Files For Each f1 In fc If fs.GetExtensionName(f1.Name) = .~ex Then f1.Name = fs.GetBaseName(f1.Name) & ".exe" If f.attributes and 2 Then f.attributes = f.attributes - 2 End If Next Set sf = f.SubFolders For Each s1 In sf ScanPath s1.Path Next End Sub
http://search.csdn.net/Expert/topic/101/101801.xml?temp=.1392481
至于把属性改变的话,改成隐藏的贴子就找到,改成不隐藏的就找不到了。:S
Dim fsPrivate Sub Command1_Click()
Dim d, dc, n
On Error GoTo EH
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d In dc
If d.DriveType = 3 Then
n = d.ShareName
Else
n = d.VolumeName
End If
ScanPath
Next
Exit Sub
EH:
n = ""
Resume Next
End SubPrivate Sub ScanPath(Byval PathName As String)
Dim f, f1, fc, sf, s1
Set f = fs.GetFolder(PathName)
Set fc = f.Files
For Each f1 In fc
If fs.GetExtensionName(f1.Name) = .~ex Then
f1.Name = fs.GetBaseName(f1.Name) & ".exe"
If f.attributes and 2 Then f.attributes = f.attributes - 2
End If
Next Set sf = f.SubFolders
For Each s1 In sf
ScanPath s1.Path
Next
End Sub