Whatever message this page gives is out now! Go check it out!
FileDelete(filepath) |
Parameter | Description |
filepath | Pathname of the on-disk or in-memory file to delete. If not an absolute path (starting with a drive letter and a colon, or a forward or backward slash), it is relative to the ColdFusion temporary directory, which is returned by the getTempDirectory function. |
<h3>FileDelete Example</h3>
<cfset sourcefile="c:\testdir\test1.txt">
<cfset destinationfile="c:\productiondir\test1.txt">
<cfif FileExists(#sourcefile#)>
<cfif FileExists(#destinationfile#)>
<cfoutput>The destination file already exists.<br>
Deleting previous copy of #destinationfile#.<br>
Moving: #sourcefile# <br>
To: <br> #destinationfile#.</cfoutput><br>
<cfscript>
FileDelete(#destinationfile#);
FileMove(#sourcefile#, #destinationfile#);
</cfscript>
<cfelse>
<cfscript>
FileMove(#sourcefile#, #destinationfile#);
</cfscript>
<cfoutput>Moved: #sourcefile# <br>
To: <br> #destinationfile#.</cfoutput><br>
</cfif>
<cfelse>
<cfoutput>The source file does not exist.</cfoutput><br>
</cfif>