title: Get extended properties from files
body: <p>I'm trying to get extended file properties from video files in the folder the script is ran from and output results to a text file.</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>Dim ls, fsObj, fd, fs, fl, sfs, sf, tf
  
      ' specify the file extensions to list
      dim fileTypes
      fileTypes = Array("mp4","mkv","avi")
  
   On Error Resume Next
  
      ls = ""
      Set fsObj = CreateObject("Scripting.FileSystemObject")
      Set fd = fsObj.GetFolder(".")
  Set objFolder = objShell.NameSpace(fsObj)
      set fs = fd.Files
  
  For Each fileName in objFolder.Items
      set objFolderItem = objFolder.ParseName(fileName)
      size = objFolder.GetDetailsOf(objFolderItem, 1)
      length = objFolder.GetDetailsOf(objFolderItem, 27)
      height = objFolder.GetDetailsOf(objFolderItem, 283)
      width  = objFolder.GetDetailsOf(objFolderItem, 285)
  Next
  
  
      ' list subfolders
      set sfs = fd.SubFolders
      For Each sf in sfs
          ls = ls &amp; sf.name &amp; vbCrLf &amp; chr(10)
      Next
  
          For Each fl in fs
          ' check whether the extension matches 
          if arrayContains(fileTypes, fsObj.GetExtensionName(fl.name))then
      ls = ls &amp; fl.name &amp; vbtab &amp; length &amp; vbCrLf &amp; chr(10)
  
          end if
      Next
      Set tf = fsObj.OpenTextFile("index.txt", 2, True, False)
  
      tf.Writeline ls
  
      tf.Close
      Set fsObj = Nothing
  
      function arrayContains (arr, val)            
          dim found
          found = false
          for i = 0 to ubound(arr)
              if arr(i) = val then    
                  found = true
                  exit for 
              end if
          next
          arrayContains = found            
      end function
  </code></pre>
  
  <p>I'm trying to get the file name and length once I can get that I can add the others.</p>
  
  <p>As far as I can guess I need to specify objFolder.ParseName(fileName). How do I specify all files that match the filetypes array? I have tried fl.name and fd.files. I don't know what else to try.</p>
  
  <p>I'm running the script by double clicking the vbs file from windows explorer in windows 7.</p>
  
  <p>The script runs with no errors and returns the file names, but doesn't return the extended properties. Any help would be greatly appreciated.</p>