|
楼主 |
发表于 2024-7-9 05:01
|
显示全部楼层
- Function FindFiles(sFolder As Folder)
- Dim tmpFile As File
- ''
- Dim Str, oStr, oStr1, Arr
- Dim oFile As File
- Dim oFld As Folder
- For Each oFile In sFolder.Files '遍历目录下所有文件
- With oFile
- If InStr(UCase(.Path), "TMP") > 0 And InStr(UCase(.Path), "$") > 0 Then
- Debug.Print .DateLastModified, .Name, .Path, Round(.Size / 1024 ^ 2, 1) & "M", Round(.Size / 1024 ^ 3, 1) & "G",
- Debug.Print .Attributes, .Drive, .OpenAsTextStream.Line
- End If
- End With
- Next
- ''
- For Each oFld In sFolder.SubFolders
- With oFld
- 'If InStr(UCase(.Path), "TMP") = 0 Or InStr(UCase(.Path), "System Volume Information") = 0 Then
- If InStr(UCase(.Path), UCase("System Volume Information")) = 0 And InStr(UCase(.Name), UCase("help")) = 0 Then
- Debug.Print oFld.Name, oFld.Path
- End If
- End With
- FindFiles oFld
-
- Next
- End Function
- Sub ll()
- Dim Fso As FileSystemObject
- Set Fso = New FileSystemObject
-
- FindFiles Fso.GetFolder("f:")
- End Sub
复制代码
|
|