Thread: File Extension
View Single Post
Old 08-28-2008   #2 (permalink)
James Whitlow


 
 

Re: File Extension

"freddy" <freddy@xxxxxx> wrote in message
news:5E4C509E-4E56-44F7-9706-3BB19CA2DBBC@xxxxxx
Quote:

>I have a script that removes files with specific file extension and the
> script works fine. Here is the script:
>
> One question in the following code
> If objFile.Extension = "txt" Or objFile.Extension = "doc" Then ...
> For each extension do I have to use objFile.Extension = "doc" or
> objFile.Extension = "RW" or objFile.Extension = "rwx" and so on.... - Is
> there an easier way to just list the file extensions without repeating
> objFile.Extension about 5 times
You could use 'Select Case':

Select Case LCase(objFile.Extension)
Case "txt","doc","rw","rwx"
'Do Something
Case Else
'Do Something Else
End Select


My System SpecsSystem Spec