Move File (script step reference)

By May 1, 2017May 20th, 2020Online Help, Troi File Plug-in
Troi File Plug-in for FileMaker Pro

Move File

Moves (or renames) a file from one location to another.

SyntaxScript step badge

Move File [ Select ; Result (error) ; Source filePath ;
            Destination filePath ; Allow different volumes ]


Select entire contentsreplaces the entire contents of a field with the result. If not checked the result replaces the currently selected portion of the field
Result (error)an error code
Source filePaththe path to the file to move
Destination filePaththe path where the file must be moved to
Allow different volumesallows the move of the file between different volumes (disks). Moving a big file across disks may take more time.

Returned Result

Data type returned

Error code


The returned result is an error code. An error always starts with 2 dollars, followed by the error code. You should always check for errors. Returned error codes can be:

0no errorThe file was moved
$$-43fnfErrSource file not found, or destination directory does not exist
$$-48dupFNErrDestination file already exists
$$-1303diffVolErrThe 2 files are on different volumes
$$-4254returnInPathErrThe path contains an illegal return character
$$-1genericErrThe file could not be moved

Other errors may be returned.

Originated in

Troi File Plug-in 9.0


FileMaker Pro 16 to 19


TIP: You can also use this function to rename a file
See also the script steps Show Select File Dialog and Show Save File Dialog” to get a filePath for a file.

When the step returns the error code $$-1303, you can use the checkbox Allow Different Volumes.


We assume that in your FileMaker file the following fields are defined:

  gErrorCode		Global, number
  gSourceFilePath	Global, text
  gDestFilePath		Global, text

gSourceFilePath should contain the path to an existing file, for example “D:\Logs\Log01.TXT” (Windows) or “Mac HD:Logs:Log 1” (Mac).
gDestFilePath should contain the path to the destination and should not exist for example “D:\New\L2000_01.TXT” (Windows) or “Mac HD:New:Log 2000_01” (Mac). In a script add the following scriptstep:

Move File [ Select ; gErrorCode ; gSourceFilePath ; gDestFilePath ]

This will move the source file to the path indicated in the gDestFilePath.

Example 2

Renaming a file: assume your C disk already contains a file “Testtext.txt”. We assume that a global number field gErrorCode is defined. Create the following script:

Move File [ Select ; gErrorCode  ; "C:\Testtext.txt" ; "C:\NewName.txt" ]

This script will move (rename) the file “Testtext.txt” to the “NewName.txt” file in the same directory. Note that on Mac OS the paths will be like: “Work Disk:NewName.txt”.

Related script stepsScript step badge

Copy File
Create File
Show Save File Dialog
Show Select File Dialog

Related functionFunction badge


Related topics

Troi File Plug-in online help (overview)

Online Help Page for Troi File Plug-in for 15 to 19 –> Move File (filep7262) 2020-0520 15:42:48