Size

(PWS4 IIS4 IIS5)
Size — 指定されたフォルダ内のすべてのファイルおよびフォルダの合計サイズをバイト単位で返します。

構文

object.Size

パラメータ

object
Folder オブジェクトを指定します。

戻り値

フォルダのサイズを返します。

説明

フォルダのサイズをバイト単位で返します。

JScript

1
2
3
4
5
6
7
8
function ShowFolderSize(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFolder(filespec);
   s = f.Name + " は、" + f.size + " バイト使用しています。";
   return(s);
}

VBScript

1
2
3
4
5
6
7
 Function ShowFolderSize(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(filespec)
   s = UCase(f.Name) & " は、" & f.size & " バイト使用しています。"
   ShowFolderSize = s
End Function

ShortName

(PWS4 IIS4 IIS5)
ShortName — 従来の 8.3 形式のファイル名が必要なプログラムのために、短いファイル名を返します。

構文

object.ShortName

パラメータ

object
Folder オブジェクトを指定します。

戻り値

ファイル名を返します。

説明

ファイル名が8文字よりも長い場合、チルダ「~」を使用して8文字に短縮して返します。

JScript

1
2
3
4
5
6
7
8
9
10
function ShowShortName(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = "ファイル名 : " + "" + f.Name;
   s += "" + "<br />";
   s += "短いファイル名 : " + "" + f.ShortName + "";
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
Function ShowShortName(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = "ファイル名 : " & "" & UCase(f.Name) & "" & "<br />"
   s = s & "短いファイル名 : " & f.ShortName
   ShowShortName = s
End Function

ShortPath

(PWS4 IIS4 IIS5)
ShortPath — 従来の 8.3 形式のファイル名が必要なプログラムのために、短いパス名を返します。

構文

object.ShortPath

パラメータ

object
Folder オブジェクトを指定します。

戻り値

パス名を返します。

説明

パス中のディレクトリ名が8文字よりも長い場合、チルダ「~」を使用して8文字に短縮して返します。

JScript

1
2
3
4
5
6
7
8
9
10
function ShowShortPath(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = "パス名 : " + "" + f.Name;
   s += "" + "<br />";
   s += "短いパス名 : " + "" + f.ShortPath + "";
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
Function ShowShortPath(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = "パス名 : " & "" & UCase(f.Name) & "" & "<br />"
   s = s & "短いパス名 : " & f.ShortPath
   ShowShortPath = s
End Function

Path

(PWS4 IIS4 IIS5)
Path — 指定されたフォルダのパスを返します。

構文

object.Path

パラメータ

object
Folder オブジェクトを指定します。

戻り値

フォルダのパスを返します。

説明

フォルダの完全なパスを返します。

JScript

1
2
3
4
5
6
7
8
9
10
11
function ShowFileAccessInfo(filespec)
{
   var fso, d, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = f.Path.toUpperCase() + "<br />";
   s += "作成日時 : " + f.DateCreated + "<br />";
   s += "最終アクセス日時 : " + f.DateLastAccessed + "<br />";
   s += "最終更新日時 : " + f.DateLastModified;
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
Function ShowFileAccessInfo(filespec)
   Dim fso, d, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = UCase(f.Path) & "<br />"
   s = s & "作成日時 : " & f.DateCreated & "<br />"
   s = s & "最終アクセス日時 : " & f.DateLastAccessed & "<br />"
   s = s & "最終更新日時 : " & f.DateLastModified
   ShowFileAccessInfo = s
End Function

ParentFolder

(PWS4 IIS4 IIS5)
ParentFolder — 指定されたフォルダが格納されているフォルダを表す Folder オブジェクトを返します。値の取得のみ可能です。

構文

object.ParentFolder

パラメータ

object
Folder オブジェクトを指定します。

戻り値

ディレクトリ名を返します。

説明

フォルダがあるディレクトリ名を返します。

JScript

1
2
3
4
5
6
7
8
9
10
11
function ShowFileAccessInfo(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = f.Name + " + f.ParentFolder + " に格納されています。<br />";
   s += "
作成日時 : " + f.DateCreated + "<br />";
   s += "
最終アクセス日時 : " + f.DateLastAccessed + "<br />";
   s += "
最終更新日時 : " + f.DateLastModified;
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
Function ShowFileAccessInfo(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = UCase(f.Name) & " & UCase(f.ParentFolder) & " に格納されています。<br />"
   s = s & "
作成日時 : " & f.DateCreated & "<br />"
   s = s & "
最終アクセス日時 : " & f.DateLastAccessed & "<br />"
   s = s & "
最終更新日時 : " & f.DateLastModified
   ShowFileAccessInfo = s
End Function

Name

(PWS4 IIS4 IIS5)
Name — 指定されたフォルダの名前を設定します。値の取得も可能です。

構文

object.Name [= newname]

パラメータ

object
Folder オブジェクトを指定します。
newname
省略可能です。object に指定したドライブの新しい名前を指定します。

戻り値

フォルダ名を返します。

説明

引数を設定した場合は、フォルダ名を設定します。

JScript

1
2
3
4
5
6
7
8
9
10
11
function ShowFileAccessInfo(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = f.Name + " は、ドライブ " + f.Drive + " にあります。<br />";
   s += "作成日時 : " + f.DateCreated + "<br />";
   s += "最終アクセス日時 : " + f.DateLastAccessed + "<br />";
   s += "最終更新日時 : " + f.DateLastModified;
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
Function ShowFileAccessInfo(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = f.Name & " は、ドライブ " & UCase(f.Drive) & " にあります。<br />"
   s = s & "作成日時 : " & f.DateCreated & "<br />"
   s = s & "最終アクセス日時 : " & f.DateLastAccessed & "<br />"
   s = s & "最終更新日時 : " & f.DateLastModified
   ShowFileAccessInfo = s
End Function

IsRootFolder

(PWS4 IIS4 IIS5)
IsRootFolder — 指定されたフォルダがルート フォルダの場合は、真 (true) を返します。ルート フォルダでなければ、偽 (false) を返します。

構文

object.IsRootFolder

パラメータ

object
Folder オブジェクトを指定します。

戻り値

フォルダがルート フォルダの場合 TRUE、それ以外の場合に FALSE を返します。

説明

指定されたフォルダがルート フォルダかどうかを調べます。

JScript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function DisplayLevelDepth(pathspec)
{
   var fso, f, n, s = "";
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFolder(pathspec);
   n = 0;
   if (f.IsRootFolder)
      s = "指定されたフォルダは、ルート フォルダです。"
   else
   {
      do
      {
         f = f.ParentFolder;
         n++;
      }
      while (!f.IsRootFolder)
      s = "指定されたフォルダは、" + n + " レベルだけネストされています。"
   }
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
Function DisplayLevelDepth(pathspec)
   Dim fso, f, n
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(pathspec)
   If f.IsRootFolder Then
      DisplayLevelDepth = "指定されたフォルダは、ルート フォルダです。"
   Else
      Do Until f.IsRootFolder
         Set f = f.ParentFolder
         n = n + 1
      Loop
      DisplayLevelDepth = "指定されたフォルダは、" & n & " レベルだけネストされています。"
   End If
End Function

Files

(PWS4 IIS4 IIS5)
Files — 指定されたフォルダ内にあるすべての File オブジェクトの入った Files コレクションを返します。このコレクションには、隠しファイルやシステム ファイルの属性を持つ File オブジェクトも含まれます。

構文

object.Files

パラメータ

object
Folder オブジェクトを指定します。

戻り値

Files コレクションを返します。

説明

フォルダから Files コレクションを作成します。

JScript

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function ShowFolderFileList(folderspec)
{
   var fso, f, fc, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFolder(folderspec);
   fc = new Enumerator(f.files);
   s = "";
   for (; !fc.atEnd(); fc.moveNext())
   {
      s += fc.item();
      s += "<br />";
   }
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
11
Function ShowFileList(folderspec)
   Dim fso, f, f1, fc, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(folderspec)
   Set fc = f.Files
   For Each f1 in fc
      s = s & f1.name
      s = s &   "<br />"
   Next
   ShowFileList = s
End Function

Drive

(PWS4 IIS4 IIS5)
Drive — 指定されたフォルダが格納されているドライブの名前を返します。値の取得のみ可能です。

構文

object.Drive

パラメータ

object
Folder オブジェクトを指定します。

戻り値

フォルダの存在するドライブ名を返します。

説明

フォルダの存在するドライブ名を返します。

JScript

1
2
3
4
5
6
7
8
9
10
11
function ShowFileAccessInfo(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = f.Name + " は、ドライブ " + f.Drive + " にあります。<br />";
   s += "作成日時 : " + f.DateCreated + "<br />";
   s += "最終アクセス日時 : " + f.DateLastAccessed + "<br />";
   s += "最終更新日時 : " + f.DateLastModified;
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
Function ShowFileAccessInfo(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = f.Name & " は、ドライブ " & UCase(f.Drive) & " にあります。<br />"
   s = s & "作成日時 : " & f.DateCreated & "<br />"
   s = s & "最終アクセス日時 : " & f.DateLastAccessed & "<br />"
   s = s & "最終更新日時 : " & f.DateLastModified
   ShowFileAccessInfo = s
End Function

DateLastModified

(PWS4 IIS4 IIS5)
DateLastModified — 指定されたフォルダが最後に更新されたときの日付と時刻を返します。値の取得のみ可能です。

構文

object.DateLastModified

パラメータ

object
Folder オブジェクトを指定します。

戻り値

フォルダが最後にアクセスされた日付を返します。

説明

OSによっては日付のみ返す場合があります。

JScript

1
2
3
4
5
6
7
8
9
10
11
function ShowFileAccessInfo(filespec)
{
   var fso, f, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.GetFile(filespec);
   s = filespec.toUpperCase() + "<br />";
   s += "作成日時 : " + f.DateCreated + "<br />";
   s += "最終アクセス日時 : " + f.DateLastAccessed + "<br />";
   s += "最終更新日時 : " + f.DateLastModified;
   return(s);
}

VBScript

1
2
3
4
5
6
7
8
9
10
Function ShowFileAccessInfo(filespec)
   Dim fso, f, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFile(filespec)
   s = UCase(filespec) & "<br />"
   s = s & "作成日時 : " & f.DateCreated & "<br />"
   s = s & "最終アクセス日時 : " & f.DateLastAccessed & "<br />"
   s = s & "最終更新日時 : " & f.DateLastModified
   ShowFileAccessInfo = s
End Function