filerename
PATH
,
NEWPATH

The filerename statement renames and/or moves a file or folder.


Parameters

This statement has two parameters:

path – is a path to the file or folder to be renamed and/or moved, including the file name (see Files and Folders for more information about file paths).

newpath – is the new name for the file or folder, or an entirely new path if the file or folder is to be moved to a new location.


Description

This statement renames and/or moves an item on disk. The item may be a single file or an entire folder.

To rename an item in place, the first parameter specifies the file or folder, while the second specifies the new name. This example causes the file index.html to be renamed home.html:

filerename "~/Documents/Web Site/index.html","home.html"

The filerename statement can also rename an entire folder (this does not affect the contents of the folder). This example changes the name of the Web Site folder, the new name is Acme Web Site:

filerename "~/Documents/Web Site","Acme Web Site"

If the second parameter contains a full path, the item will be moved to a new location (and will also be renamed, if the file name is different). This example moves a file from the Documents folder into the Dropbox folder:

filerename "~/Documents/logo.png","~/Dropbox/logo.png"

You can rename and move an item all in one fell swoop:

filerename "~/Documents/logo.png","~/Dropbox/newlogo.png"

You can also move an entire folder all at once:

filerename "~/Documents/Web Site","~/Dropbox/Acme Web Site"

Keep in mind that moving an item is different than copying it. When you copy an item (see copyfile and copyfolder) Panorama creates a second copy of the item in the new location, but the original remains in place. When you move an item, the item is removed from the original location. There is no additional copy made.

If the old and new locations of the item are on the same disk, the item can be moved almost instantaneously. However, if the new location is on a different disk, the operation can take a significant amount of time. To move an item across disks, Panorama actually copies the item and then erases the original item. Especially for folders, this can take quite a bit of time.

Legacy Three Parameter Syntax

Previous versions of Panorama (version 6 and before) used a three parameter format for the filerename statement:

filerename folder,filename,newfilename

For compatibility with existing databases, this format still works.


See Also


History

VersionStatusNotes
10.0UpdatedCarried over from Panorama 6.0 but now uses a 2 parameter syntax (path,newpath). The filerename statement also now allows items to be moved to a new location as well as being renamed. (The old 3 parameter syntax is still available.)