Comment detail

指定されたフォルダ以下のゴミ掃除 (Nested Flatten)

VBA for Excel (2003)。デストローイ。ノーフューチャー。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Sub Main()
  Dim p, o
  With Application.FileDialog(msoFileDialogFolderPicker)
    .Show
    p = .SelectedItems(1)
    Set o = CreateObject("Scripting.FileSystemObject")
    Call Df(p, o)
  End With
End Sub

Sub Df(p, o)
  Dim f, d
  With o.GetFolder(p)
    For Each f In .Files
      If Right(f.Name, 1) = "~" Then
        f.Delete
      End If
    Next
    For Each d In .SubFolders
      Call Df(p + "\" + d.Name, o)
    Next
  End With
End Sub

Index

Feed

Other

Link

Pathtraq

loading...