【WSH】指定したフォルダのファイル一覧を取得する

このエントリーをはてなブックマークに追加
Bookmark this on Livedoor Clip

指定したフォルダのファイル一覧を取得します。再帰処理でサブフォルダ内のファイル名も取得します。


Option Explicit
Private Function GET_FileList(STR_Path)

  Dim OBJ_FSO
  Dim OBJ_Folder
  Dim COL_SubFolder
  Dim COL_File

  Set OBJ_FSO = WScript.CreateObject("Scripting.FileSystemObject")
  Set OBJ_Folder = OBJ_FSO.GetFolder(STR_Path)

  For Each COL_File In OBJ_Folder.Files

    WScript.Echo COL_File.Name

  Next

  For Each COL_SubFolder In OBJ_Folder.SubFolders

    GET_FileList(COL_SubFolder)

  Next

End Function

 Scriptのダウンロードは こちら です。

VN:F [1.9.13_1145]
Rating: 8.0/10 (6 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 1 vote)
【WSH】指定したフォルダのファイル一覧を取得する, 8.0 out of 10 based on 6 ratings
This entry was posted in Windows, WSH.

コメントを残す

メールアドレスが公開されることはありません。

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

1 / 11