ColdFusion failed to delete file for unknown reason

I am trying to delete and recreate the test file, but I am getting the error below. Can someone tell me why this is happening?

Error:

ColdFusion could not delete the file e:\sample\test2.html for an unknown reason.

The code:

<cfif FileExists("e:\sample\test2.html")>
   <cffile action="delete"file="e:\sample\test2.html"><br>
   <p>deleted the file </p>
<cfelse>
   <p>Sorry, can't delete the file - it doesn't exist.</p>
</cfif>

<cfset createObject("java", "java.lang.Thread").sleep(JavaCast("int", 90000))>
<cfsavecontent variable="HTML">
    <cfinclude template="noticeEmail.cfm">
</cfsavecontent>        

<cffile action="WRITE"  attributes = "normal" nameconflict="Overwrite"  
      file="e:\sample\test2.html" output="#HTML#">
+3
source share
4 answers

The first thing I would like to check out is the permissions for the user who runs ColdFusion.
I don’t know how you run CF or what environment you are in, but assuming this is a local development environment, they are on a Windows machine and start ColdFusion as a service:

  • Find the ColdFusion service in the service manager (start -> run -> services.msc)
  • ColdFusion , " . ( , , " ColdFusion 9", , JRun Macromedia).
  • , , / e:\sample\test2.html

, , , ( ColdFusion)

, ?
", - ". - , , , .

, , , , , , , .

+2

MS Word ColdFusion

<cfif FileExists( WordFilePath &".doc")>
   <cffile action="delete"
       file="#WordFilePath#.doc">
<cfelse>
    Sorry, can't delete the file - it doesn't exist.
</cfif>
0

-/os . , , , ? .

0

, , , . FileExists, . :

<cfset sFilename = REQUEST.SubscriberWebFiles
                        & form.SubscriberID & "\Attachments\" 
                        & qryAttachmentsTrash.AttachmentName>

Trim:

<cfset sFilename = Trim(REQUEST.SubscriberWebFiles
                       & form.SubscriberID & "\Attachments\" 
                       & qryAttachmentsTrash.AttachmentName)>

!

0

All Articles