Sub get_ichiran(path)
Dim fs As Variant
Dim fld As Variant
Dim ichiran As Variant
Dim file As Variant
Set fs = CreateObject(“Scripting.FileSystemobject”) ‘Folderオブジェクトに変換
Set fld = fs.GetFolder(path)
Set ichiran = fld.FileSystemobject ‘ファイル一覧を取得
For Each file In ichiran
ActiveCell.Value = path
ActiveCell.Offset(0, 1).Value = file.Name
ActiveCell.Offset(0, 2).Value = file.DataLastModified
ActiveCell.Offset(0, 3).Value = file.Size
ActiveCell.Offset(1, 0).Select
Next file
Dim subpathichiran As Variant
Set subpathichiran = fld.SubFolders ‘サブフォルダ一覧を取得
For Each subpath In subpathichiran
path = subpath
get_ichiran (path)
Next subpath
Set fs = Nothing
Set fld = Nothing
Set ichiran = Nothing
Set subpathichiran = Nothing
End Sub
この記事へのコメントはありません。