oi phumes1!!

fileexists()


-- 
Critz
Certified Adv. ColdFusion Developer

Crit[s2k] - <CF_ChannelOP Network="Efnet" Channel="ColdFusion">
------------------------------------
Tuesday, June 4, 2002, 10:18:46 AM, you wrote:

p> I need to check if a file exists on the server and if so, run some code.

p> Whats the best way to check if the file "test.txt" exists in a directory

p> The below doesn't seem to work. Note that the filename can change but the 
p> file extension (.txt) will stat the same.

p> <cfset FileName = ListLast(url.filename, "\")>
p> <cfset DirPath = Left(url.filename, Evaluate(Len(url.filename) - 
len(FileName) - 1))>>
p> <cfset TheFile = ListLast(url.filename)>
p> <cfset TheFolder = DirPath>

p> <cfparam name="dir" default="#TheFolder#">
p> <cfdirectory action="LIST" directory="#dir#" name="FileCheck">
p> <cfoutput query="FileCheck">
p> <cfif FileCheck.name IS "test.txt">
p>    <h3>Found Match</h3>
p> <cfelse>
p>    <h3>No Match</h3>
p> </cfif>
p> </cfoutput>



p> 
+-----------------------------------------------------------------------------------+ 

p> Philip Humeniuk
p> [EMAIL PROTECTED]
p> [EMAIL PROTECTED]
p> 
+------------------------------------------------------------------------------------+


p> 
______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to