getting type of Files

pckm_123

Member
Joined
Aug 4, 2003
Messages
7
I have the functions to read properties of the files. Like no matter what the file extension (.doc, .xls, .tiff,.giff, .pdf.etc.) is it tells what type of the file is, such as Microsft Word, Microsoft Excel, Powerpoint, Adobe Acrobat, Jpeg file, and so on.

but it only works for excel and word

I found those the functions on microsoft.com

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/stg/stg/enumall_sample.asp

and the other link is
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnolegen/html/msdn_propset.asp


how can i tell this given file name ( with path) is Adobe Acrobat file, or Jpeg file, or Tiff file or Word file, or Access file etc?


thank you



thank you
 
Try this:
********************************************
[VB]Public Sub getFileExt()
Dim fileName(), dirPath as String
Dim fN as String, f as System.IO.FileInfo
dirPath = "your directory path"
fileName() = System.IO.Directory.GetFiles(dirPath)
Try
For Each fN In fileName
f = New System.IO.FileInfo(fN)
If f.Extension = ".doc" then
do something
Elseif f.Extension = ".tiff" then
do something else
End if
Next
Catch
Your error message
End Try
Exit Sub[/VB]

********************************************
There may be better ways to do this, but this has worked for me.
Regards -
 
Back
Top