Helpful Information
 
 
Category: ASP Programming
I need to find a file but only have partial name

I'm looking for images in my asp page.

I know the path and first and last part of the filename.

Example filename: A01-30420.jpg

I have the A01- and the .jpeg. The ##### portion could be anything, but always numeric (sofar).

The A01 is unique, i.e. there will only be one file of A01-#####.jpg

I'm using fileExists object to confirm a file exists when I have the full filename but havn't been able to figure out how to get the full filename when I only have a partial.

I could rename the files, i.e. drop the -##### but I'd have to do that everytime I get new ones so I'd like to work with the original filename if at all possible.

Thanks in advance

Heinz

Think you could just get all of the files:

dir=server.MapPath(somedir)
Set fso = CreateObject("Scripting.FileSystemObject")
Set files = fso.GetFolder(dir)

then just use a loop to look for it...

i think you could even have somedir be C:\foo.* but i am not 100% sure on that

Thanks Tron.

I did sort of a stopgap using basically what you described in an asp page to permanently rename and then I can look for the name directly.

Maybe next time I get a bunch I'll rethink/redo :-))

Heinz

so i guess you figured it out??










privacy (GDPR)