
Using extension instead of "type" data
set objMyFolder = objFileSystem.GetFolder(strMyFolder)
set objMyFileSet = objMyFolder.Files
for each objFile in objMyFileSet
if (lcase(objFileSystem.GetExtensionName(objFile.name)) = "ini") Then
wscript.echo objFile.name
end if
Next
--
Michael Harris
Microsoft.MVP.Scripting
--
Quote:
> Never mind - as usual, I saw an easy way immediately after posting ;).
Any flaws in this approach?
Quote:
> set objMyFolder = objFileSystem.GetFolder(strMyFolder)
> set objMyFileSet = objMyFolder.Files
> for each objFile in objMyFileSet
> if (lcase(Right(objFile.name,4)) = ".ini") Then
> wscript.echo objFile.name
> end if
> Next
Quote:
> > I would like to get the file extension from a collection of files. Is
there an easy way to access this, analogous to getting the
Quote:
> > file type?
> > Here's a snippet of code-
> > set objMyFolder = objFileSystem.GetFolder(strMyFolder)
> > set objMyFileSet = objMyFolder.Files
> > for each objFile in objMyFileSet
> > wscript.echo objFile.name
> > wscript.echo objFile.type
> > Next
> > only instead of "type" I would like to get the extension. My intent is
to filter the collection based on extensions, some of
Quote:
> which
> > may not be in the registry.