ソース掲示板




すべてから検索

キーワード   条件 表示 現行ログ 過去ログ トピックス 名前 本文
ディレクトリ内のディレクトリサイズ一覧 ( No.0 )
日時: 2018/02/02 17:51
名前: lightbox



【ASPの場合】 

※ 対象ディレクトリの構造によっては、時間のかかる処理となるので注意が必要です

http://winofsql.jp/wsf/folder_size.asp

拡張子:
<%
' **********************************************************
' HTTP ヘッダ
' **********************************************************
Call Response.AddHeader( "Content-Type", "text/html; Charset=shift_jis" )
Response.ExpiresAbsolute=#May 31,2000 23:59:59#

' **********************************************************
' laylaClass 読み込み
' **********************************************************
Set obj = CreateObject("Msxml2.ServerXMLHTTP.3.0")
strUrl = "http://lightbox.in.coocan.jp/laylaClass.vbs"
on error resume next
Call obj.Open("GET", strUrl, False )
if Err.Number <> 0 then
	Response.Write Err.Description
	Response.End
end if
on error goto 0
obj.Send
strFunction = obj.responseText
ExecuteGlobal strFunction
Call laylaFunctionTarget( "http://lightbox.in.coocan.jp/" )
Call laylaLoadFunction( "baseFunction.vbs" )

GetFso

' **********************************************************
' 対象ディレクトリ
' **********************************************************
target = "対象となるフルパス"

' **********************************************************
' フォルダオブジェクト取得
' **********************************************************
Set objFolder =  Fso.GetFolder(target)

' **********************************************************
' サブフォルダコレクション取得
' **********************************************************
Set colSubFolder = objFolder.SubFolders

' **********************************************************
' 一覧
' **********************************************************
Response.Write "<TABLE>"
For Each obj in colSubFolder

	Response.Write "<TR>"
	Response.Write "<TD>"
	Response.Write obj.Name
	Response.Write "</TD>"
	Response.Write "<TD style='text-align:right'>"
	on error resume next
	Response.Write FormatNumber((Fix(obj.Size / 1000) / 1000),3) & " M" 
	if Err.Number <> 0 then
		Response.Write Err.Description
	end if
	on error goto 0
	Response.Write "</TD>"
	Response.Write "</TR>"

Next
Response.Write "</TABLE>"

%>