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

Renames files or folders.

Syntax
Pascal
class procedure Rename(const pFileNames: IItemIdListCollection; const pNewname: string; pOptions: TOperationOptions = soDefault); overload; static;
Parameters 
Description 
const pFileNames: IItemIdListCollection 
The files or folders that should be renamed.  
const pNewname: string 
The new name of the specified files or folders.  
pOptions: TOperationOptions = soDefault 
Optional: The options to use.  
Exceptions 
Description 
EArgumentException 
if pNewname is empty.  
if pFileNames contains no valid ItemIdList or if any COM exception occured.  

The following example shows how to rename multiple files. A number suffix is automatically added to the new name.

  var
    Files: IItemIdListCollection;
  begin
    Files := TItemIdListCollection.Create;
    Files.Add('C:file1.exe');
    Files.Add('C:file2.exe');
    TJamFileOperation.Rename(Files, 'New name.exe');
  end;