Brian Dunning's FileMaker Custom Functions

CopyMoveFile ( ~OriginalFilePath ; ~EndFilePath ; ~MacServerPath ; ~PCServerPath ; ~MoveOrCopy )

Move or Copy a file in Finder or Explorer using CMD or Terminal commands

  Average rating: 5.0 (3 votes) Log in to vote

Reeve Schragger   Reeve Schragger
White Studio

Share on Facebook Share on Twitter

  Sample input:
CopyMoveFile (
"X:/MainFolder/Subfolder/File.pdf" ;
"X:/MainFolder/NewFolder/FileCopied.pdf" ;
"/Volumes/DataServer/" ;
"X:/" ;
"C" ;
  Sample output:
do shell script "cp " & quoted form of "/Volumes/DataServer/MainFolder/Subfolder/File.pdf" & " " & quoted form of "/Volumes/DataServer/MainFolder/NewFolder/FileCopied.pdf"

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

In my work I move lots of files around for printing and sometimes need to switch between platforms. I was sick of using my separate custom functions for doing this and having to re-program.
Now I can use 1 custom function. I can make a variable and pass it to BOTH an Applescript AND a Send Event step and, regardless of the platform, I will have a correctly formatted terminal command to run in the script step that works on that platform.

The only bit that is not obvious is the "~MacServerPath ; ~PCServerPath ;".
You will have "different" beginnings to a Mac and Windows address for the same file. For example;
Mac: "/Volumes/DataServer/MainFolder/Subfolder/File.pdf"
Win: "X:/MainFolder/Subfolder/File.pdf"

Therefore I use the substitute command where I would (in this case) replace "/Volumes/DataServer/" with "x:/" were I going onto a PC but the path was formed on the Mac (and the opposite).
90% of the time this step is unnecessary so I just put " 1 ; 1 ;" in there if the solution is a single platform job and it cancels itself out.

PS. This is my first upload, any constructive criticism would be appreciated



Log in to post comments.


Note: these functions are not guaranteed or supported by Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.