Renaming a Local File or Folder (LocalRename)

Use the LocalRename method to rename a file or folder on your local hard disk.

Syntax

Object.LocalRename(BSTR bstrFrom, BSTR bstrTo)

Parameters

BstrTo

This contains the folder's new name in its full absolute path.

BstrFrom

This contains the folder's old name in its full absolute path.

Example

Set MySite = CreateObject("CuteFTPPro.TEConnection")

'Initialize all necessary fields for MySite : host name, user, password, etc.

MySite.LocalRename "c:\file.txt", "e:\temp\users\file.exe"

 

 

Make sure you specify the full source and destination path. If you had written the command as MySite.LocalRename "c:\file.txt", "file.exe", thinking it would rename it using relative paths, you might be surprised to find that your file has been moved to your profiles folder (system dependent). In essence, the LocalRename is similar to a MOVE command issued through drag and drop with the added name change sequence.