ColdFusion 9.0 Resources |
FileMoveParameters
UsageUse the following syntax to specify an in-memory file, which is not written to disk. In-memory files speed processing of transient data. ram:///filepath The filepath can include directories, for example ram:///petStore/images/poodle.jpg. Create the directories in the path before you specify the file. For more information on using in-memory files, see Optimizing transient files in the Developing ColdFusion Applications. ExampleThe following example moves the test1.txt file from the c:\testingdir\ directory to the c:\productiondir\ directory in Windows and renames the file test2.txt: <h3>FileMove Example</h3> <cfset sourcefile="c:\testingdir\test1.txt"> <cfset destinationfile="c:\productiondir\test2.txt"> <cfif FileExists(#sourcefile#)> <cfif FileExists(#destinationfile#)> <cfoutput>The destination file already exists.</cfoutput> <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> |