ColdFusion 9.0 Resources |
FileDeleteParameters
UsageUse this function to free the memory used by an in-memory file. For more information on using in-memory files, see Optimizing transient files in the Developing ColdFusion Applications. ExampleThe following example deletes the file c:\productiondir\test1.txt before moving c:\testdir\test1.txt: <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> |