PDA

View Full Version : Checking for files?


simmo
06-20-02, 02:46
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

JonathanB
06-27-02, 10:53
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....

EvE
08-21-02, 09:31
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>

kanejone
08-26-02, 13:47
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