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 White Studio http://www.whitestudio.net.au |
"X:/MainFolder/Subfolder/File.pdf" ;
"X:/MainFolder/NewFolder/FileCopied.pdf" ;
"/Volumes/DataServer/" ;
"X:/" ;
"C" ;
)
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
Comments
Stuart Rechter May 30, 2022 |
||
Hi Reeve, this looks really good. Is there a way I can check for an existing file with the same name on the new path, before running this function, so that I can sequentially number my file to make it unique before the move? | ||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.