You can form a query of queries on the directory query perhaps?
<cfquery name="qFileSet" dbtype="query">
SELECT
name
FROM
qDirList
WHERE
name LIKE <cfqueryparam value="jsmith%.pdf" />
</cfquery>
This will get jsmith.pdf, jsmith2.pdf... But will also get
jsmith-big-sexy.pdf (so be carefule). Also, LIKE in query of queries IS case
sensitive so careful on that to. You can do a LOWER() on the name first if
you like.
.......................
Ben Nadel
www.bennadel.com
Certified Advanced ColdFusion Developer
Need Help?
www.bennadel.com/ask-ben/
-----Original Message-----
From: Orlini, Robert [mailto:[EMAIL PROTECTED]
Sent: Thursday, September 14, 2006 11:41 AM
To: CF-Talk
Subject: wildcard
I have pdf files in a directory that CF reads using cfdirectory. It finds
the filename under the user's name such as "jsmith.pdf", but at times a user
may have two pdf files in the directory such as "jsmith.pdf" and
"jsmith2.pdf".
How can I have it find both instances? Can I use a wildcard character such
as "*"?
For example:
<cfloop query="dirlist"> <!--- loop outputs the file names and sizes of each
file ---> #name*# </cfloop>
I tried this and got an error. See my code below.
Thanks for any help.
Robert O.
HWW
<cfloop list="#form.thelist#" index="i"> <!--- loop through the list of
names w/ i holding the individual names ---->
<cfoutput>name: #i#<br>
<cfdirectory directory="e:/pdfs" action="list" name="dirlist" filter="#i#*">
<!--- check the directory for the no. of files w/ a name like the user name
exist ---> no. of files: #dirlist.recordcount#<br> <!--- shows how many of
each file exists --->
<cfloop query="dirlist"> <!--- loop outputs the file names and sizes of each
file ---> #name# <br> </cfloop><br>
</cfoutput>
</cfloop>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253122
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4