Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

vbscript get file extension

Posted on 2009-04-06
1
Medium Priority
?
19,941 Views
Last Modified: 2012-05-06
Hi guys was wondering if anyone knew why i cant get this code to run?
Cheers
Nathan
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "D:\"
 
Set objFolder = objFSO.GetFolder(objStartFolder)
Set objExtension = objFSO.GetExtensionName("D:/") 
Set colFiles = objFolder.Files
For Each objFile in colFiles
	If objExtension = "jpeg" then
    Wscript.Echo objFile.Name
	End if
Next

Open in new window

0
Comment
Question by:nathanlukewong
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 48

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 2000 total points
ID: 24076720
Try the below code.

Wayne
     Set objfso = CreateObject("Scripting.FileSystemObject")
     objStartFolder = "D:\" 
     Set objFolder = objfso.GetFolder(objStartFolder)
     For Each objFile In objFolder.Files
          If objfso.GetExtensionName(objFile) = "jpeg" Then
               Wscript.Echo objFile.Name
          End If
     Next

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question