another objFSO question.

J

Jeff Uchtman

Is there a way to omit files listed if using objFSO to query a folder? I
have it set to list every image in a folder and return name, size, date with
the ability to view or delete the images, but some images should not be
deleted. I would like to omit these name from the query objFSO returns.

Thanks
Jeff
 
M

Manohar Kamath [MVP]

Since you have to list the file programatically, you could omit files when
you list them:

For Each File in oFolder.Files
' List files only if they are not images
If LCase(Right(File.Name, 4)) <> ".gif" OR LCase(Right(File.Name, 4)) <>
".jpg" then
' Write code to show the files
End If

Next
 
J

Jeff Uchtman

Thanks Manohar. Is there anyway to list the files I don't want shown and
draw the exclude from the list as this folder contains other gif's and
jpg's?

Jeff
 
K

Ken Schaefer

You could do something like:
a) create a delimited list of files to exclude (eg a comma separated list)
b) for each file, see if InStr(strExcludeList, strFileName) returns > 1 and
if so, exclude the file, else write it out.

Cheers
Ken

: Thanks Manohar. Is there anyway to list the files I don't want shown and
: draw the exclude from the list as this folder contains other gif's and
: jpg's?
:
: Jeff
:
:
: : > Since you have to list the file programatically, you could omit files
when
: > you list them:
: >
: > For Each File in oFolder.Files
: > ' List files only if they are not images
: > If LCase(Right(File.Name, 4)) <> ".gif" OR LCase(Right(File.Name,
4))
: <>
: > ".jpg" then
: > ' Write code to show the files
: > End If
: >
: > Next
: >
: > --
: > Manohar Kamath
: > Editor, .netBooks
: > www.dotnetbooks.com
: >
: >
: > : > > Is there a way to omit files listed if using objFSO to query a folder?
: I
: > > have it set to list every image in a folder and return name, size,
date
: > with
: > > the ability to view or delete the images, but some images should not
be
: > > deleted. I would like to omit these name from the query objFSO
returns.
: > >
: > > Thanks
: > > Jeff
: > >
: > >
: >
: >
:
:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top