Item Property (Files)

 

Gets the specified item for in a Files object

Syntax

object.Item(key)[ = newitem]

Arguments

  • object
    Required. The name of a File object.

  • spec
    Required. The name of the item.

Remarks

If the file is found, this property returns the full path name of the file. If the file is not found, this property throws an error "File not found".

The following example illustrates the use of the Item property.

function ShowFolderFileList(folderspec, filespec)
{
   var fso, f, f1, fc, s;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   //get the folder by giving its path
   f = fso.GetFolder(folderspec);
   fc = f.files;
   s = fc.Item(filespec);
   return(s);
}
Function ShowFolderList(folderspec, filespec)
   Dim fso, f, f1, fc, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   'get the folder by giving its path
   Set f = fso.GetFolder(folderspec)
   Set fc = f.Files
   Set s = fc.Item(filespec)
   ShowFolderList = s
End Function

Applies To:

Files Collection

See Also

Count Property (Files)