#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Langley, BC Canada
    Posts
    35
    Rep Power
    13

    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

    Comments on this post

    • Gran Roguismo agrees
  2. #2
  3. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    15
    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
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2001
    Location
    Langley, BC Canada
    Posts
    35
    Rep Power
    13
    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

    Comments on this post

    • Gran Roguismo agrees
  6. #4
  7. SwollenMember
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    the master control
    Posts
    264
    Rep Power
    15
    so i guess you figured it out??

IMN logo majestic logo threadwatch logo seochat tools logo