Delphi Programming RTL Reference|By Category|Alphabetically|By Unit
function RenameFile(const FileName, NewFileName: string): boolean;
Changes the name of a specified file.
RenameFile returns False if the file specified by FileName cannot be renamed (for example, if the application does not have permission to modify the file).
//the following example will
//rename the application's file name.
var thisapp, thisapp_newname : string;
thisapp := Application.ExeName;
thisapp_newname := ExtractFilePath(thisapp) + 'OHOHO_NewName.exe';
if not RenameFile(thisapp, thisapp_newname) then begin
ShowMessage('Could not rename THIS application');
end;
|
Deleting group of files
The code example demonstrates using the SHFileOperation function to copy a group of files and display a progress dialog. You can also use the following flags to delete, move and rename a group of files.
DeleteFile, ExtractFilePath
|
Free Delphi code snippet inside every Delphi Newsletter! |
|
|
|
Got some code to share? Got a question? Need some help? |
|
|