Discuss this help topic in CBFS Forum

OnRenameOrMoveFile event/delegate/callback


Pascal    C++ (Lib)    C++ (VCL)    C++ (.NET)    C#    VB.NET    Java 

CallbackFileSystem     See also    


This event is fired when the OS needs to rename or move the file within a file system.


    property OnRenameOrMoveFile : TCbFsRenameOrMoveFileEvent;
    TCbFsRenameOrMoveFileEvent = procedure( Sender : TObject; FileInfo: TCbFsFileInfo; NewFileName: TCBString ) of object;
    type TCBString = {$ifdef UNICODE}UnicodeString{$else}WideString{$endif};

[C++ (Lib)]
    void (__stdcall *CbFsRenameOrMoveFileEvent)(void* Sender, CbFsFileInfo* FileInfo, wchar_t* NewFileName );

[C++ (VCL)]
    typedef void (__closure *TCbFsRenameOrMoveFileEvent)( System::TObject* Sender, TCbFsFileInfo* FileInfo, TCBString NewFileName );

[C++ (.NET)]
    public __delegate void CbFsRenameOrMoveFileEvent( CallbackFileSystem^ Sender, CbFsFileInfo^ FileInfo, String^ NewFileName );

    public void CbFsRenameOrMoveFileEvent( CallbackFileSystem Sender, CbFsFileInfo FileInfo, String NewFileName );

    Sub CbFsRenameOrMoveFileEvent( ByVal Sender As CallbackFileSystem, ByVal FileInfo As CbFsFileInfo, ByVal NewFileName As String )

    ICbFsFileEvents.onRenameOrMoveFile( CallbackFileSystem sender, CbFsFileInfo fileInfo, String newFileName );


  • Sender - reference to the class that called the delegate/event handler
  • FileInfo - contains the information about the file
  • NewFileName - new fully qualified name for the file.


This event is fired when the OS needs to rename or move the file within a file system.

Windows API functions (MoveFile and MoveFileEx) let the calling process specify what to do if the destination already exist. The process may request the destination file to be overriden or the operation can be cancelled. CBFS driver handles this parameter internally (as it knows whether the destination exists). This event is fired only when the operation must be performed, i.e. the destination file either doesn't exist or the calling process requested the destination to be overriden. If the event handler doesn't "want" to override the file, it can throw the exception with the appropriate error code.

Error handling

See Error handling topic for detailed information about how to report errors, which occur in the event handlers, back to Callback File System.

See also


Discuss this help topic in CBFS Forum