fileoperations Rename method
Example
Return to Introduction  Previous page  Next page
Applies to
dcFileOperations component.  

Declaration
function Rename: Boolean; // returns True if succeed  

Description
The Rename method renames the file(s) and/or folder(s) described in the FileList property. The new names should be described in the FileList as well, and separated from original names by "=" sign. The items of the FileList should have following format:  
 
path\OldName=samepath\NewName  
 
iiwarning files can not be renamed to another disk or directory, so "new" path must be equal to original. For example:  
 
FileList.Clear;  
// long filenames must be in quotes (")  
FileList.Add('"C:\My Files\doc.txt"="C:\My Files\mydoc.doc"');  
FileList.Add('"C:\folder"="C:\my folder"');  

See also
Execute, Copy, Move, and Delete methods.