Created
October 30, 2017 11:28
-
-
Save Lycheejam/8473c424a27cc885971e6d5ad3772fbc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Public Sub txtSearch(Path As String, copySaki As String) | |
Dim buf As String | |
Dim f As Object | |
Dim saki As String | |
Dim moto As String | |
buf = Dir(Path & "\*.txt") | |
'dirで指定の拡張子があればbufに格納される | |
'bufにファイル名が入っていればコピー実行 | |
Do While buf <> "" | |
moto = Path & "\" & buf | |
saki = copySaki & "\" & buf | |
FileCopy moto, saki | |
buf = Dir() | |
Loop | |
'フォルダがある限り自分を呼び出して潜り続けて最後まで行くと一個戻ってまた潜る | |
With CreateObject("Scripting.FileSystemObject") | |
For Each f In .getfolder(Path).subfolders | |
Call txtSearch(f.Path, copySaki) | |
Next f | |
End With | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment