I know others have already responded to this with good enough versions.
I like my version better--more flexibility. And it's in Jscript
var accept = { txt : true, jpg : true, html : true }
var hash = new Object()
var fso = new ActiveXObject( "Scripting.FileSystemObject" )
var folder = fso.getFolder( "C:\\My Documents\\" ) // or whatever
folder you need
var file, ext, stat = "( "
for ( var en = new Enumerator( folder.files );
!en.atEnd(); en.moveNext() ) {
file = en.item()
ext = fso.getExtensionName( file.name )
if ( !hash[ext] ) hash[ext] = 0
hash[ext]++
Quote:
}
for ( x in hash ) {
if ( accept[x] ) {
stat += hash[x] + " " + x + ", "
}
Quote:
}
WSH.echo( stat.substr( 0, stat.length - 2 ) + " )" )
Quote:
> how to display the individual file type of a folder, let's say
> a folder contain :
> 10 text document (txt file)
> 2 jpeg image (jpg file)
> 3 HTML document (html file)
> what i want is to display the only 3 type of files(text document, html
> document, and jpg file) in a msgbox. i tried before but my script
display
> all the file types (10 txt, 2 jpg , 3 html)
> thnak for help
Sent via Deja.com http://www.deja.com/
Before you buy.