本帖最后由 czjt1234 于 2023-4-1 11:03 编辑
- ' & cls & cscript.exe /nologo /e:vbs "%~f0" "D:\A" >out.txt & pause & exit
-
- Dim oFSO, oFolder, s
-
- Set oFSO = CreateObject("Scripting.FileSystemObject")
- Set oFolder = oFSO.GetFolder(Wsh.Arguments(0))
-
- s = ""
- Call EnumFolders(oFolder.Path)
- s = Left(s, Len(s) - 2)
-
- Sub EnumFolders(ByVal folderPath)
- Dim oFolder
- On Error Resume Next
- s = s & folderPath & vbCrLf
- For Each oFolder In oFSO.GetFolder(folderPath).SubFolders
- Call EnumFolders(oFolder.Path)
- Next
- End Sub
-
- For Each i In Split(s, vbCrLf)
- Set oFolder = oFSO.GetFolder(i)
- If oFolder.SubFolders.Count = 0 Then
- Wsh.Echo oFolder.Path & " [" & oFolder.Files.Count & "个文件]"
- End If
- Next
复制代码
把 D:\A 改成你指定的文件夹 |