Skip to main content
April 7, 2007
Question

cffile delete

  • April 7, 2007
  • 2 replies
  • 283 views
hi i have a cfile deletewhich works on a schedule task, when there is no file there i get an error,

is there a way of using cfif to determine if the file is present ?

ie if file is present, run delete code

This topic has been closed for replies.

2 replies

Inspiring
April 7, 2007
Cold fusion has an isDefined function. I'm not sure, they might even have an isFile function.

Or, you could use cftry/cfcatch.
Inspiring
April 7, 2007
<cfif fileexists(fullpathtofile)>

you can get fullpathtofile, which has to be ABSOLUTE path, with
#expandpath("relativepathtofile")#
--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com