ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
Jam.Shell.Dialogs.FileOperation.TJamFileOperation.Rename

Renames a file or folder.

Syntax
Pascal
class procedure Rename(const pFileName: IItemIdList; const pNewname: string; pOptions: TOperationOptions = soDefault); overload; static;
Parameters 
Description 
const pFileName: IItemIdList 
The file or folder that should be renamed.  
const pNewname: string 
The new name of the specified file or folder.  
pOptions: TOperationOptions = soDefault 
Optional: The options to use.  

To avoid name conflicts use TOperationOption.soRenameCollision in Options.

Exceptions 
Description 
EArgumentException 
if pNewname is empty.  
if pFileName is invalid or if any COM exception occured.  

The following example shows how to rename a file:

  var
    ItemIdList: IItemIdList;
  begin
    ItemIdList := TJamItemIdList.Create('C:file.exe');
    TJamFileOperation.Rename(ItemIdList, 'New name.exe');
  end;