Results 1 to 4 of 4
  1. #1
    Join Date
    May 2002
    Location
    Sydney
    Posts
    15

    Unanswered: Checking for files?

    Hi,

    I want to be able to check and find files if they exist.

    The only problem is i don't know specifically what the file name will be. I know that a certain number will exist in the file name (e.g. 8056) but there will be other letters and numbers following that will vary.

    For example there could be file names called C8056S.CPX, C8056LG1.CPX, C8056LG2.CPX, C8056LG3.CPX, C8056LG4.CPX....etc

    Is there any way that i can check for all these using something of the sorts of a wildcard search (E.g *8056*.CPX)??

    Any help would be greatly appreciated

    Simon

  2. #2
    Join Date
    Feb 2002
    Location
    North Wales, UK
    Posts
    114
    Hmm... I'm not aware of any asp objects that would allow you to do this. But I have to ask.. if you know a certain amount about the filename there must be some logic to the rest of the filename?? Of course I'm assuming they are being generated by another application....
    J^ - web | email
    newsASP Developer

  3. #3
    Join Date
    Aug 2002
    Location
    Holland
    Posts
    16
    I hope I understood you well, but here is my suggestion:

    <HTML>
    <HEAD><TITLE> Showing files</TITLE></HEAD>
    <BODY>

    <%
    Set fs = Server.CreateObject( "Scripting.FileSystemObject")
    Set folder = fs.Getfolder("c:\My Documents\TestSite\test\fso-object")
    FOR EACH file IN folder.Files
    %>
    <br> <a href ="<%=file.Name%>"><%=file.Name%></a>
    <%
    NEXT
    %>
    </BODY>
    </HTML>

  4. #4
    Join Date
    Aug 2002
    Posts
    3
    Just a little addition to Eve's code. Hope this helps. I needed the same type of thing a while ago and remember a good sample from www.asp101.com.

    The link is http://www.asp101.com/samples/dir_list_sort.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •