Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

file type from list of folder files

Status
Not open for further replies.

peterpann

Programmer
Jun 19, 2007
63
GB
How can I select file types from a list of files in a folder ? The following didn't work
var f = fso.GetFolder(folderspec);
var fc = new Enumerator(f.Files);
for (; !fc.atEnd(); fc.moveNext() )
{
if ( fc.Type == "JPEG Image" )
 
You can base it on the file extension, but there are three caveats:

1) The above code will only work in IE,

2) The file extension shouldn't be used as a 100% accurate reflection of the real file type, as ultimately, files can have any extension,

3) Even Windows Explorer gets the file type wrong baed on the extension - if I rename a .PDF to a .JPG, for example, it tells me it is a JPEG Image when clearly it is not.

Hope this helps,

Dan




Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top