Count    : 85
Average  :
Sum      : 1738905280
Maximum  :
Minimum  :
Property : Length
countはファイル数
sumはフォルダのサイズ(bit単位)
※注意
C:\Program Files、C:\Windowsのようなフォルダ以外のフォルダを指定してください。
VBScript
Public Function GetFileCountRecursive(byVal strFolder)
        Dim count 'ファイル数
        count = 0
        Dim fso
        Set fso = CreateObject("Scripting.FileSystemObject")
        call FileCount(fso.GetFolder(strFolder),count)
        GetFileCountRecursive = count
    End Function
    Private Sub FileCount(Folder, byRef count)
        count = count + Folder.Files.Count
        Dim Subfolder
        For Each Subfolder in Folder.SubFolders
            call FileCount(SubFolder,count)
        next
    End Sub
    '-------------------------------------------------------------------------------------------
    ' 指定フォルダ以下のファイルサイズの取得
    '-------------------------------------------------------------------------------------------    
    ' strFolder - フォルダ名(文字列)
    '-------------------------------------------------------------------------------------------    
    Public Function GetFolderSize(byVal strFolder)
        Dim fso
        Set fso = CreateObject("Scripting.FileSystemObject")
        Dim Folder
        Set Folder = fso.GetFolder(strFolder)
        Dim Size
        Size = Folder.Size
        GetFolderSize = Size
    End Function
Windows PowerShell実践システム管理ガイド (マイクロソフト公式解説書―マイクロソフトITプロフェッショナルシリーズ)
posted with amazlet at 12.12.19
目時 秀典 横田 秀之 
日経BPソフトプレス
売り上げランキング: 126509
日経BPソフトプレス
売り上げランキング: 126509
この記事がお役にたちましたらシェアをお願いします:)
0 件のコメント:
コメントを投稿