|
纯练手。。。
- Sub ykcbf() '//2024.5.28
- Application.ScreenUpdating = False
- Set fso = CreateObject("scripting.filesystemobject")
- Set d = CreateObject("Scripting.Dictionary")
- ' p = "D:\Attachments"
- p = ThisWorkbook.path & ""
- On Error Resume Next
- Set ff = fso.GetFolder(p)
- For Each fd In ff.SubFolders
- st = Split(fd.Name, "-")(1)
- d.RemoveAll
- For Each f In fd.Files
- If InStr(f.Name, "~$") = 0 Then
- fn = fso.GetExtensionName(f)
- d(fn) = d(fn) + 1
- fn1 = st & IIf(d(fn) = 1, "", "-" & d(fn) - 1) & "." & fn
- f.Name = fn1
- End If
- Next f
- Next fd
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|