File.Sizeサイズ プロパティ

本ページには広告が含まれています。

File オブジェクトが示すファイルのサイズを取得します。

構文
  1. Integer = File.Size
引数
戻り値

File オブジェクトを返すメソッド・プロパティ

FSO.GetFile メソッド
指定したパスのFile オブジェクトを返します。
File.Size プロパティ
コレクションから単一のオブジェクトを返します。

関連するメソッド・プロパティ

.png
項目メソッド・プロパティ
種類
場所
リンク先ShellLinkObject.Path プロパティ (Shell)
作業フォルダーShellLinkObject.WorkingDirectory プロパティ (Shell)
ショートカットキーShellLinkObject.Hotkey プロパティ (Shell)
実行時の大きさFile.Size (Shell)
コメントFile.Size (Shell)
.png
項目メソッド・プロパティ
.png
項目メソッド・プロパティ
名前File.Size プロパティ
種類File.Type プロパティ
フォルダーのパス
サイズFile.Size プロパティ
作成日時File.Size プロパティ
更新日時File.DateLastModified プロパティ
属性File.Size プロパティ
所有者Folder.GetDetailsOf メソッド (Shell)
コンピューター
.png
項目メソッド・プロパティ

使い方

D:\Desktop\textfile.txtのファイルサイズをバイト単位で取得します。

UWSC
DIM FSO = CREATEOLEOBJ("Scripting.FileSystemObject")
DIM File = FSO.GetFile("D:\Desktop\textfile.txt")

PRINT File.Size
結果
プレーンテキスト
9287

プログラム実行例

Windowsフォルダのファイル情報を取得

UWSC
DIM FSO = CREATEOLEOBJ("Scripting.FileSystemObject")
DIM Folder = FSO.GetSpecialFolder(0)
PRINT "ファイル名,パス,サイズ"

FOR File IN Folder.Files
	WITH File
		PRINT .Name + "," + .Path + "," + formatBytes(.Size)
	ENDWITH
NEXT
結果
CSV
ファイル名,              パス,                               サイズ
bfsvc.exe,               C:\Windows\bfsvc.exe,               79.5KB
Bluestream.bmp,          C:\Windows\Bluestream.bmp,          2.25MB
bootstat.dat,            C:\Windows\bootstat.dat,            66.00KB
BRRBCOM.INI,             C:\Windows\BRRBCOM.INI,             15.71KB
Core.xml,                C:\Windows\Core.xml,                29.16KB
csup.txt,                C:\Windows\csup.txt,                10.00Bytes
diagerr.xml,             C:\Windows\diagerr.xml,             11.17KB
diagwrn.xml,             C:\Windows\diagwrn.xml,             11.17KB
eiunin21.exe,            C:\Windows\eiunin21.exe,            609.00KB
EPMBatch.ept,            C:\Windows\EPMBatch.ept,            1.44KB
explorer.exe,            C:\Windows\explorer.exe,            5.01MB
HelpPane.exe,            C:\Windows\HelpPane.exe,            1.03MB
hh.exe,                  C:\Windows\hh.exe,                  18.00KB
iis.log,                 C:\Windows\iis.log,                 112.45KB
iphlpapi.dll,            C:\Windows\iphlpapi.dll,            92.5KB
mib.bin,                 C:\Windows\mib.bin,                 42.12KB
msdfmap.ini,             C:\Windows\msdfmap.ini,             1.37KB
NDSTray.INI,             C:\Windows\NDSTray.INI,             0Bytes
notepad.exe,             C:\Windows\notepad.exe,             196.5KB
pala_wsxga.bmp,          C:\Windows\pala_wsxga.bmp,          3.71MB
pala_wuxga.bmp,          C:\Windows\pala_wuxga.bmp,          6.59MB
pala_wxga.bmp,           C:\Windows\pala_wxga.bmp,           2.93MB
pala_xga.bmp,            C:\Windows\pala_xga.bmp,            2.25MB
PFRO.log,                C:\Windows\PFRO.log,                1.31MB
py.exe,                  C:\Windows\py.exe,                  902.67KB
pyshellext.amd64.dll,    C:\Windows\pyshellext.amd64.dll,    56.67KB
pyw.exe,                 C:\Windows\pyw.exe,                 902.67KB
regedit.exe,             C:\Windows\regedit.exe,             361.5KB
setupact.log,            C:\Windows\setupact.log,            6.83KB
setuperr.log,            C:\Windows\setuperr.log,            0Bytes
splwow64.exe,            C:\Windows\splwow64.exe,            160.00KB
system.ini,              C:\Windows\system.ini,              219.00Bytes
TPSCCfg.exe,             C:\Windows\TPSCCfg.exe,             460.43KB
tvgadget.scr,            C:\Windows\tvgadget.scr,            504.00KB
twain_32.dll,            C:\Windows\twain_32.dll,            63.5KB
twin.dlt,                C:\Windows\twin.dlt,                5.55KB
win.ini,                 C:\Windows\win.ini,                 478.00Bytes
WindowsShell.Manifest,   C:\Windows\WindowsShell.Manifest,   670.00Bytes
WindowsUpdate.log,       C:\Windows\WindowsUpdate.log,       276.00Bytes
winhlp32.exe,            C:\Windows\winhlp32.exe,            11.5KB
WLXPGSS.SCR,             C:\Windows\WLXPGSS.SCR,             294.86KB
WMPrfJpn.prx,            C:\Windows\WMPrfJpn.prx,            22.76KB
WMSysPr9.prx,            C:\Windows\WMSysPr9.prx,            309.22KB
write.exe,               C:\Windows\write.exe,               11.00KB
_MSRSTRT.EXE,            C:\Windows\_MSRSTRT.EXE,            2.5KB
使用関数