Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFFILE EXISTS ?

Status
Not open for further replies.

gsaini

Programmer
Jun 19, 2000
5
US
What is occurring is that i can get the files with my cfset yourfile.&nbsp;&nbsp;This bring in most of the files that i am looking for.&nbsp;&nbsp;Although there are some files in this directory that either have a &quot;ra&quot; attached to the front or a letter attached to the end<br><br>RA31529.pdf<br>or<br>RA31529b.pdf<br>or 31529a.pdf<br><br><br>i can bring in all the files that do not have &quot;ra&quot; or a &quot;letter&quot; behind them<br><br>is there a way that i can parse these files and also pull in the ones with &quot;ra&quot; and or with a &quot;letter&quot; behind them?<br><br><br>&lt;CFSET yourFile = &quot;..\some\#funding.folder#\&quot; & funding.id & &quot;.pdf&quot;&nbsp;&nbsp;&gt; <br><br>that is what i use to get the files back from the file system<br><br>
 
CFFILE will read any filename you tell it to read. If it is not reading files with RA in the filename then it is because you have the filename wrong.<br>There is no built in filter to avoid these files.<br><br> <p>Russ Michaels<br><a href=mailto:russ@satachi.com>russ@satachi.com</a><br><a href= Internet Development</a><br>Rapid Web application development, specialising in Coldfusion, database integration and e-commerce solutions.
 
I apologize.&nbsp;&nbsp;i am using cfile to see of it exists, although i am taking 2 variables and concatinating them folder and then the id and add.pdf to the end of it.&nbsp;&nbsp;when this occours some of these files have a ra attached to the front.&nbsp;&nbsp;but it is the correct number.&nbsp;&nbsp;although it will not pull them in for some reason.&nbsp;&nbsp;here is the full text of the code.&nbsp;&nbsp;any information would be greatly apprciated.<br><br><br><br>select funding_no as folder, medtep_id as id<br>from products_cf <br>where source_type = 'MEDTEP'<br>ORDER BY FUNDING_NO<br>&lt;/CFQUERY&gt;<br><br><br><br>&lt;cfif isdefined (&quot;funding.folder&quot;)&gt;<br>&lt;cfelse&gt;<br>yo&nbsp;&nbsp;no&nbsp;&nbsp;pass&nbsp;&nbsp;nutin <br>&lt;/cfif&gt;<br><br><br>&lt;CFSET thisPath= ExpandPath(&quot;*.*&quot;)&gt;<br>&lt;CFSET thisDirectory= (&quot;#funding.folder#&quot;)&gt;<br><br><br>&lt;CFIF&nbsp;&nbsp;IsDefined(&quot;funding.id&quot;)&gt;<br>&lt;CFIF funding.id is not &quot;&quot;&gt;<br>&lt;CFDIRECTORY ACTION = &quot;LIST&quot; <br> DIRECTORY=&quot;c:\inetpub\ <br>&nbsp;&nbsp;&nbsp;&nbsp;NAME=&quot;myDirectory&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;SORT=&quot;name ASC, size DESC&quot;&gt;<br> <br> <br><br> <br><br>&lt;cfoutput query=&quot;funding&quot;&gt;<br>&lt;CFSET yourFile = &quot;..\some\#funding.folder#\&quot; & funding.id & &quot;.pdf&quot;&nbsp;&nbsp;&gt; <br><br><br><br>&nbsp;&nbsp;<br> &lt;CFIF FileExists(ExpandPath(yourfile))&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P&gt;Your file exists in this directory #funding.folder#.&nbsp;&nbsp;You entered #funding.id#<br>&nbsp;&nbsp;&nbsp;&nbsp;the correct file name, <br> <br><br> &lt;CFELSE&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P&gt;&lt;B&gt;Your file #funding.id#.pdf&lt;br&gt; was not found in this directory #funding.folder#&lt;/b&gt;<br><br> &lt;/cfif&gt;<br> &lt;/cfoutput&gt;<br> &lt;/cfif&gt;<br> &lt;/cfif&gt;
 
You could try something like this:<br><FONT FACE=monospace><br>&lt;CFDIRECTORY ACTION = &quot;LIST&quot; <br>DIRECTORY=&quot;c:\inetpub\ <br>&nbsp;&nbsp;&nbsp;&nbsp;NAME=&quot;myDirectory&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;SORT=&quot;name ASC, size DESC&quot;&gt;<br><br>&lt;cfoutput query=&quot;myDirectory&quot;&gt;<br>&nbsp;&nbsp;&lt;cfif name contains funding.id&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;Your file exists in the directory #funding.folder# as #name#.<br>&nbsp;&nbsp;&lt;cfelse&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;p&gt;&lt;b&gt;Your file #funding.id#.pdf&lt;br&gt; was not found in the directory #funding.folder#&lt;/b&gt;<br>&nbsp;&nbsp;&lt;/cfif&gt;<br>&lt;/cfoutput&gt;<br></font>
 
this somewhat works but i ahve a sql query that pulls in funding.id and i can not name the query to that sql query because it then doen not know what name is.&nbsp;&nbsp;any suggestions?
 
here is the full code.&nbsp;&nbsp;what is happening is that i have to take the folder and id number add them together and then add .pdf to the end to see of the file exists on the webserver.&nbsp;&nbsp;but some of these files have a ra in front of them or a letter behind them.&nbsp;&nbsp;<br><br><br>&lt;cfquery name=&quot;FUNDING&quot;&gt;<br>select funding_no as folder, medtep_id as id<br>from products_cf <br>where source_type = 'something'<br>ORDER BY FUNDING_NO<br>&lt;/CFQUERY&gt;<br><br><br>&lt;cfif isdefined (&quot;funding.folder&quot;)&gt;<br>&lt;cfelse&gt;<br>yo&nbsp;&nbsp;no&nbsp;&nbsp;pass&nbsp;&nbsp;nutin <br>&lt;/cfif&gt;<br>&lt;CFSET thisPath= ExpandPath(&quot;*.*&quot;)&gt;<br>&lt;CFSET thisDirectory= (&quot;#funding.folder#&quot;)&gt;<br><br><br>&lt;CFIF&nbsp;&nbsp;IsDefined(&quot;funding.id&quot;)&gt;<br>&lt;CFIF funding.id is not &quot;&quot;&gt;<br><br>&lt;cfoutput query=&quot;funding&quot;&gt;<br>&lt;CFSET yourFile = &quot;..\some\#funding.folder#\&quot; & funding.id & &quot;.pdf&quot;&nbsp;&nbsp;&gt; <br>&nbsp;<br> &lt;CFIF&nbsp;&nbsp;FileExists(ExpandPath(yourfile))&gt; <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P&gt;Your file exists in this directory #funding.folder#.&nbsp;&nbsp;You entered #funding.id#<br>&nbsp;&nbsp;&nbsp;&nbsp;the correct file name, <br><br><br> &lt;CFELSE&gt;<br> <br>&nbsp;&nbsp;&nbsp;&nbsp;&lt;P&gt;&lt;B&gt;Your file #funding.id#.pdf&lt;br&gt; was not found in this directory #funding.folder#&lt;/b&gt;<br><br> &lt;/cfif&gt;<br> &lt;/cfoutput&gt;<br> &lt;/cfif&gt;<br> &lt;/cfif&gt;<br><br>&lt;cfoutput&gt;<br>#funding.recordcount#<br>&lt;/cfoutput&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top