Moving, Renaming, Copying, and Deleting Server Files  
 
 

With CFFILE, you can create application pages to manage files on your Web server. You can use the tag to move files from one directory to another, rename files, copy a file, or delete a file.

The examples below show static values for many of the attributes. However, the value of all or part of any attribute in a CFFILE tag can be a dynamic parameter. This makes CFFILE a very powerful tool.

 
 
  Moving a file (ACTION="MOVE")  
 
 

CFFILE can be used to move a file from one location on the server to another.

 
 
  Example  
 

The following example moves the file "KeyMemo.doc" file from the c:\files\upload\ directory to the c:\files\memo\ directory:

<CFFILE ACTION="MOVE"
    SOURCE="c:\files\upload\KeyMemo.doc"
    DESTINATION="c:\files\memo\">
 
 
  Renaming a file (ACTION="RENAME")  
 
 

CFFILE can be used to rename a file on a server.

 
 
  Example  
 

The following example renames the file KeyMemo.doc to OldMemo.doc:

<CFFILE ACTION="Rename"
    SOURCE="c:\files\memo\KeyMemo.doc"
    DESTINATION="c:\files\memo\OldMemo.doc">
 
 
  Copying a file (ACTION="COPY")  
 
 

CFFILE can be used to copy a file from one directory to another on the server.

 
 
  Example  
 

The following example saves a copy of the KeyMemo.doc file in the c:\files\backup\ directory:

<CFFILE ACTION="Copy"
    SOURCE="c:\files\upload\KeyMemo.doc"
    DESTINATION="c:\files\backup\">
 
 
  Deleting a file (ACTION="DELETE")  
 
 

CFFILE can be used to delete a file on the server.

 
 
  Example  
 

The following example permanently deletes the specified file:

<CFFILE ACTION="Delete"
    FILE="c:\files\upload\"oldfile.txt">


 
 
BackUp LevelNext
 
 

allaire     AllaireDoc@allaire.com
    Copyright © 1998, Allaire Corporation. All rights reserved.